add other dialog services demo;

This commit is contained in:
Dotnet9(dotnet9.com)
2024-07-25 08:48:20 +08:00
parent d9e86526af
commit a25e23c1d1
2 changed files with 29 additions and 8 deletions

View File

@@ -8,7 +8,8 @@
Title="Ursa.PrismDialogDemo">
<Grid>
<StackPanel>
<Button Click="DialogButton_OnClick">Show Dialog</Button>
<Button Click="OverlayDialogButton_OnClick">Show Overlay Dialog</Button>
<Button Click="AloneDialogButton_OnClick">Show Alone Dialog</Button>
<Button Click="DrawerButton_OnClick">Show Drawer</Button>
</StackPanel>
<u:OverlayDialogHost/>

View File

@@ -1,28 +1,48 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using DryIoc;
using Ursa.Controls;
using Ursa.Controls.Options;
using Ursa.PrismExtension;
namespace Ursa.PrismDialogDemo;
public partial class MainWindow : Window
{
private IUrsaOverlayDialogService _dialogService;
private IUrsaDrawerService _drawerService;
public MainWindow(IUrsaOverlayDialogService dialogService, IUrsaDrawerService drawerService)
private readonly IUrsaOverlayDialogService _overlayDialogService;
private readonly IUrsaDialogService _aloneDialogService;
private readonly IUrsaDrawerService _drawerService;
public MainWindow(IUrsaOverlayDialogService overlayDialogService, IUrsaDialogService aloneDialogService,
IUrsaDrawerService drawerService)
{
InitializeComponent();
_dialogService = dialogService;
_overlayDialogService = overlayDialogService;
_aloneDialogService = aloneDialogService;
_drawerService = drawerService;
}
private void DialogButton_OnClick(object? sender, RoutedEventArgs e)
private void OverlayDialogButton_OnClick(object? sender, RoutedEventArgs e)
{
_dialogService.ShowModal("Default", null, null, null);
_overlayDialogService.ShowModal("Default", null, null, new OverlayDialogOptions()
{
Title = "This is dialog title"
});
}
private void AloneDialogButton_OnClick(object? sender, RoutedEventArgs e)
{
_aloneDialogService.ShowModal("Default", null, null, new DialogOptions()
{
Title = "This is dialog title"
});
}
private void DrawerButton_OnClick(object? sender, RoutedEventArgs e)
{
_drawerService.ShowModal("Default", null, null, null);
_drawerService.ShowModal("Default", null, null, new DrawerOptions()
{
Title = "This is dialog title"
});
}
}