なろうブックマーク分析用ツールのPrism+MAUIサンプル実装
Rev. | 25963e22509f33d08a861a9dfadd9425437419d0 |
---|---|
Tamaño | 1,272 octetos |
Tiempo | 2023-09-30 20:52:00 |
Autor | yoshy |
Log Message | [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;
}
}