Add KeyBindingBehavior
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public class NavigateHandler(IComponentScopeProvider provider) :
|
||||
public class NavigateHandler(ComponentScope scope,
|
||||
IComponentScopeProvider provider) :
|
||||
INotificationHandler<Navigate>
|
||||
{
|
||||
public async Task Handle(Navigate args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (provider.Get(args.Scope ?? "Default")
|
||||
is IServiceProvider scope)
|
||||
if (provider.Get(args.Scope ?? scope.Name)
|
||||
is ComponentScopeDescriptor descriptor)
|
||||
{
|
||||
if (scope.GetService<INavigationScope>() is INavigationScope navigationScope)
|
||||
if (descriptor?.Services?.GetService<INavigationScope>() is INavigationScope navigationScope)
|
||||
{
|
||||
await navigationScope.NavigateAsync(args.Route, args.Sender,
|
||||
args.Context, args.Navigated, args.Parameters, cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user