This commit is contained in:
TheXamlGuy
2024-06-15 14:24:30 +01:00
parent 370e6bf96b
commit 7a811acde5
11 changed files with 32 additions and 26 deletions
+7 -1
View File
@@ -25,7 +25,13 @@ public class ContentFactory(IMediator mediator,
initialization.Initialize();
}
}, parameters)
: provider.GetRequiredKeyedService(descriptor.ContentType, descriptor.Key);
: provider.GetRequiredKeyedService(descriptor.ContentType, args =>
{
if (args is IInitialization initialization)
{
initialization.Initialize();
}
}, descriptor.Key);
return content;
}
@@ -1,5 +0,0 @@
namespace Toolkit.Foundation;
public interface INavigateBackHandler<TNavigation> :
INotificationHandler<NavigateBackEventArgs<TNavigation>>,
INavigateHandler;
-7
View File
@@ -1,7 +0,0 @@
namespace Toolkit.Foundation;
public interface INavigateHandler;
public interface INavigateHandler<TNavigation> :
INotificationHandler<NavigateEventArgs<TNavigation>>,
INavigateHandler;
@@ -0,0 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
namespace Toolkit.Foundation;
public static class IServiceProviderExtensions
{
public static object GetRequiredKeyedService(this IServiceProvider provider,
Type serviceType,
Action<object> serviceDelegate,
object? serviceKey)
{
object service = provider.GetRequiredKeyedService(serviceType, serviceKey);
serviceDelegate.Invoke(service);
return service;
}
}
+1 -1
View File
@@ -96,7 +96,7 @@ public class NavigationScope(IServiceProvider provider,
Type navigateType = typeof(NavigateBackEventArgs<>).MakeGenericType(navigationType);
if (Activator.CreateInstance(navigateType, [region]) is object navigate)
{
publisher.Publish(navigate);
publisher.Publish(navigate, navigationType.Name);
}
}
}
+1 -1
View File
@@ -403,7 +403,7 @@ public partial class ObservableCollection<TItem> :
IsCompatibleObject(value) ?
IndexOf((TItem)value!) : -1;
public Task Initialize()
public virtual Task Initialize()
{
if (Initialized)
{