なろうブックマーク分析用ツールのPrism+MAUIサンプル実装
Rev. | 25963e22509f33d08a861a9dfadd9425437419d0 |
---|---|
Tamanho | 1,272 bytes |
Hora | 2023-09-30 20:52:00 |
Autor | yoshy |
Mensagem de Log | [MOD] CleanAuLait.MAUI パッケージのリネームに伴う対応 (CleanAuLait.Prism.MAUI )
|
using Prism.Common;
namespace Prism.Ioc;
public static class NavigationRegistrationExtensionsPatched
{
public static IContainerRegistry RegisterForNavigationPatched<TView>(this IContainerRegistry container, string name = null)
where TView : Page =>
container.RegisterForNavigationPatched(typeof(TView), null, name);
public static IContainerRegistry RegisterForNavigationPatched<TView, TViewModel>(this IContainerRegistry container, string name = null)
where TView : Page =>
container.RegisterForNavigationPatched(typeof(TView), typeof(TViewModel), name);
public static IContainerRegistry RegisterForNavigationPatched(this IContainerRegistry container, Type view, Type viewModel, string name = null)
{
if (view is null)
throw new ArgumentNullException(nameof(view));
if (string.IsNullOrEmpty(name))
name = view.Name;
container.RegisterInstance(new ViewRegistration
{
Type = ViewType.Page,
Name = name,
View = view,
ViewModel = viewModel
})
.Register(view);
if (viewModel != null && !viewModel.IsInterface)
container.Register(viewModel);
return container;
}
}