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"> Title="Ursa.PrismDialogDemo">
<Grid> <Grid>
<StackPanel> <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> <Button Click="DrawerButton_OnClick">Show Drawer</Button>
</StackPanel> </StackPanel>
<u:OverlayDialogHost/> <u:OverlayDialogHost/>

View File

@@ -1,28 +1,48 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using DryIoc; using DryIoc;
using Ursa.Controls;
using Ursa.Controls.Options;
using Ursa.PrismExtension; using Ursa.PrismExtension;
namespace Ursa.PrismDialogDemo; namespace Ursa.PrismDialogDemo;
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private IUrsaOverlayDialogService _dialogService; private readonly IUrsaOverlayDialogService _overlayDialogService;
private IUrsaDrawerService _drawerService; private readonly IUrsaDialogService _aloneDialogService;
public MainWindow(IUrsaOverlayDialogService dialogService, IUrsaDrawerService drawerService) private readonly IUrsaDrawerService _drawerService;
public MainWindow(IUrsaOverlayDialogService overlayDialogService, IUrsaDialogService aloneDialogService,
IUrsaDrawerService drawerService)
{ {
InitializeComponent(); InitializeComponent();
_dialogService = dialogService; _overlayDialogService = overlayDialogService;
_aloneDialogService = aloneDialogService;
_drawerService = drawerService; _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) 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"
});
} }
} }