fixed a bunch of isses with keyed handlers
This commit is contained in:
@@ -8,31 +8,31 @@ public class NavigateHandler(NamedComponent scope,
|
||||
{
|
||||
public Task Handle(NavigateEventArgs args)
|
||||
{
|
||||
INavigation? navigationScope = null;
|
||||
INavigation? navigation = null;
|
||||
if (args.Scope is "self" || args.Scope is "new")
|
||||
{
|
||||
if (args.Sender is IServiceProviderRequired requireServiceProvider)
|
||||
{
|
||||
if (args.Scope is "self")
|
||||
{
|
||||
navigationScope = requireServiceProvider.Provider.GetRequiredService<INavigation>();
|
||||
navigation = requireServiceProvider.Provider.GetRequiredService<INavigation>();
|
||||
}
|
||||
|
||||
if (args.Scope is "new")
|
||||
{
|
||||
IServiceScope serviceScope = requireServiceProvider.Provider.CreateScope();
|
||||
navigationScope = serviceScope.ServiceProvider.GetRequiredService<INavigation>();
|
||||
navigation = serviceScope.ServiceProvider.GetRequiredService<INavigation>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (navigationScope is null)
|
||||
if (navigation is null)
|
||||
{
|
||||
ComponentScopeDescriptor? descriptor = componentScopeProvider.Get(args.Scope ?? scope.Name);
|
||||
navigationScope = descriptor?.Services?.GetRequiredService<INavigation>();
|
||||
navigation = descriptor?.Services?.GetRequiredService<INavigation>();
|
||||
}
|
||||
|
||||
navigationScope?.Navigate(args.Route, args.Sender,
|
||||
navigation?.Navigate(args.Route, args.Sender,
|
||||
args.Region, args.Navigated, args.Parameters);
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
||||
Reference in New Issue
Block a user