diff --git a/src/Ursa.PrismExtension/IUrsaDrawerService.cs b/src/Ursa.PrismExtension/IUrsaDrawerService.cs new file mode 100644 index 0000000..7d97bfc --- /dev/null +++ b/src/Ursa.PrismExtension/IUrsaDrawerService.cs @@ -0,0 +1,10 @@ +using Ursa.Controls; +using Ursa.Controls.Options; + +namespace Ursa.PrismExtension; + +public interface IUrsaDrawerService +{ + public Task ShowDrawer(string viewName, object? vm, string? hostId = null, DefaultDrawerOptions? options = null); + public Task ShowCustomDrawer(string viewName, object? vm, string? hostId = null, CustomDrawerOptions? options = null); +} \ No newline at end of file diff --git a/src/Ursa.PrismExtension/UrsaDialogServiceExtension.cs b/src/Ursa.PrismExtension/UrsaDialogServiceExtension.cs index 7e57ffb..ca8d043 100644 --- a/src/Ursa.PrismExtension/UrsaDialogServiceExtension.cs +++ b/src/Ursa.PrismExtension/UrsaDialogServiceExtension.cs @@ -11,6 +11,7 @@ public static class UrsaDialogServiceExtension { containerRegistry.RegisterSingleton(); containerRegistry.RegisterSingleton(); + containerRegistry.RegisterSingleton(); } public static void RegisterUrsaDialogView(this IContainerRegistry containerRegistry, string name) where T : Control diff --git a/src/Ursa.PrismExtension/UrsaDrawerService.cs b/src/Ursa.PrismExtension/UrsaDrawerService.cs new file mode 100644 index 0000000..99b9a43 --- /dev/null +++ b/src/Ursa.PrismExtension/UrsaDrawerService.cs @@ -0,0 +1,22 @@ +using Avalonia.Controls; +using Prism.Ioc; +using Ursa.Controls; +using Ursa.Controls.Options; + +namespace Ursa.PrismExtension; + +public class UrsaDrawerService(IContainerExtension container): IUrsaDrawerService +{ + public Task ShowDrawer(string viewName, object? vm, string? hostId = null, DefaultDrawerOptions? options = null) + { + var v = container.Resolve(UrsaDialogServiceExtension.UrsaDialogViewPrefix + viewName); + return Drawer.Show(v, vm, hostId, options); + } + + public Task ShowCustomDrawer(string viewName, object? vm, string? hostId = null, + CustomDrawerOptions? options = null) + { + var v = container.Resolve(UrsaDialogServiceExtension.UrsaDialogViewPrefix + viewName); + return Drawer.ShowCustom(v, vm, hostId, options); + } +} \ No newline at end of file