Improve Publisher
This commit is contained in:
@@ -5,16 +5,17 @@ namespace Toolkit.Foundation;
|
||||
public class NavigateBackHandler(IComponentScopeProvider provider) :
|
||||
INotificationHandler<NavigateBackEventArgs>
|
||||
{
|
||||
public async Task Handle(NavigateBackEventArgs args,
|
||||
CancellationToken cancellationToken)
|
||||
public Task Handle(NavigateBackEventArgs args)
|
||||
{
|
||||
if (provider.Get(args.Scope ?? "Root")
|
||||
is ComponentScopeDescriptor descriptor)
|
||||
{
|
||||
if (descriptor?.Services?.GetService<INavigationScope>() is INavigationScope navigationScope)
|
||||
{
|
||||
await navigationScope.NavigateBackAsync(args.Context, cancellationToken);
|
||||
navigationScope.Back(args.Context);
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user