Tidy
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ public partial class ObservableCollection<TItem> :
|
||||
IsCompatibleObject(value) ?
|
||||
IndexOf((TItem)value!) : -1;
|
||||
|
||||
public Task Initialize()
|
||||
public virtual Task Initialize()
|
||||
{
|
||||
if (Initialized)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user