Improve Publisher

This commit is contained in:
TheXamlGuy
2024-05-14 19:24:07 +01:00
parent adb5ffe57a
commit 4ba58a9863
22 changed files with 93 additions and 140 deletions
@@ -8,8 +8,7 @@ namespace Toolkit.Avalonia;
public class ClassicDesktopStyleApplicationHandler : public class ClassicDesktopStyleApplicationHandler :
INavigateHandler<IClassicDesktopStyleApplicationLifetime> INavigateHandler<IClassicDesktopStyleApplicationLifetime>
{ {
public Task Handle(NavigateEventArgs<IClassicDesktopStyleApplicationLifetime> args, public Task Handle(NavigateEventArgs<IClassicDesktopStyleApplicationLifetime> args)
CancellationToken cancellationToken = default)
{ {
if (Application.Current?.ApplicationLifetime is if (Application.Current?.ApplicationLifetime is
IClassicDesktopStyleApplicationLifetime lifeTime) IClassicDesktopStyleApplicationLifetime lifeTime)
+1 -2
View File
@@ -7,8 +7,7 @@ namespace Toolkit.Avalonia;
public class ContentControlHandler : public class ContentControlHandler :
INavigateHandler<ContentControl> INavigateHandler<ContentControl>
{ {
public async Task Handle(NavigateEventArgs<ContentControl> args, public async Task Handle(NavigateEventArgs<ContentControl> args)
CancellationToken cancellationToken)
{ {
if (args.Context is ContentControl contentControl) if (args.Context is ContentControl contentControl)
{ {
+2 -3
View File
@@ -6,8 +6,7 @@ namespace Toolkit.Avalonia;
public class ContentDialogHandler(IDispatcher dispatcher) : public class ContentDialogHandler(IDispatcher dispatcher) :
INavigateHandler<ContentDialog> INavigateHandler<ContentDialog>
{ {
public async Task Handle(NavigateEventArgs<ContentDialog> args, public async Task Handle(NavigateEventArgs<ContentDialog> args)
CancellationToken cancellationToken)
{ {
if (args.Context is ContentDialog contentDialog) if (args.Context is ContentDialog contentDialog)
{ {
@@ -86,7 +85,7 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
} }
// A hack to wait for the dialog to finish loading up to make it appear more responsive // A hack to wait for the dialog to finish loading up to make it appear more responsive
await Task.Delay(250, cancellationToken); await Task.Delay(250);
if (content is IInitializer initializer) if (content is IInitializer initializer)
{ {
await initializer.Initialize(); await initializer.Initialize();
+2 -4
View File
@@ -12,8 +12,7 @@ public class FrameHandler :
INavigateHandler<Frame>, INavigateHandler<Frame>,
INavigateBackHandler<Frame> INavigateBackHandler<Frame>
{ {
public Task Handle(NavigateEventArgs<Frame> args, public Task Handle(NavigateEventArgs<Frame> args)
CancellationToken cancellationToken)
{ {
if (args.Context is Frame frame) if (args.Context is Frame frame)
{ {
@@ -136,8 +135,7 @@ public class FrameHandler :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(NavigateBackEventArgs<Frame> args, public Task Handle(NavigateBackEventArgs<Frame> args)
CancellationToken cancellationToken = default)
{ {
if (args.Context is Frame frame) if (args.Context is Frame frame)
{ {
@@ -8,8 +8,7 @@ namespace Toolkit.Avalonia;
public class SingleViewApplicationHandler : public class SingleViewApplicationHandler :
INavigateHandler<ISingleViewApplicationLifetime> INavigateHandler<ISingleViewApplicationLifetime>
{ {
public Task Handle(NavigateEventArgs<ISingleViewApplicationLifetime> args, public Task Handle(NavigateEventArgs<ISingleViewApplicationLifetime> args)
CancellationToken cancellationToken = default)
{ {
if (Application.Current?.ApplicationLifetime is if (Application.Current?.ApplicationLifetime is
ISingleViewApplicationLifetime lifeTime) ISingleViewApplicationLifetime lifeTime)
+1 -1
View File
@@ -13,7 +13,7 @@ public class AppService(IEnumerable<IInitializer> initializers,
await initializer.Initialize(); await initializer.Initialize();
} }
await publisher.Publish<StartedEventArgs>(cancellationToken); publisher.Publish<StartedEventArgs>(cancellationToken);
} }
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
@@ -20,8 +20,7 @@ public partial class ComponentConfigurationViewModel<TConfiguration, TValue, THe
{ {
} }
public Task Handle(ChangedEventArgs<TConfiguration> args, public Task Handle(ChangedEventArgs<TConfiguration> args)
CancellationToken cancellationToken = default)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -58,8 +57,7 @@ public partial class ComponentConfigurationViewModel<TConfiguration, TValue, TAc
return base.OnActivated(); return base.OnActivated();
} }
public Task Handle(ChangedEventArgs<TConfiguration> args, public Task Handle(ChangedEventArgs<TConfiguration> args)
CancellationToken cancellationToken = default)
{ {
if (args.Value is TConfiguration configuration) if (args.Value is TConfiguration configuration)
{ {
@@ -101,8 +99,7 @@ public partial class ComponentConfigurationViewModel<TConfiguration, TValue, TDe
return base.OnActivated(); return base.OnActivated();
} }
public Task Handle(ChangedEventArgs<TConfiguration> args, public Task Handle(ChangedEventArgs<TConfiguration> args)
CancellationToken cancellationToken = default)
{ {
if (args.Value is TConfiguration configuration) if (args.Value is TConfiguration configuration)
{ {
@@ -5,8 +5,7 @@ public class ConfigurationChangedHandler<TConfiguration, TValue>(ConfigurationVa
where TValue : where TValue :
class, new() class, new()
{ {
public Task Handle(ChangedEventArgs<TConfiguration> args, public Task Handle(ChangedEventArgs<TConfiguration> args)
CancellationToken cancellationToken = default)
{ {
if (args.Value is TConfiguration configuration) if (args.Value is TConfiguration configuration)
{ {
@@ -9,7 +9,7 @@ public class ConfigurationInitializer<TConfiguration>(IConfigurationReader<TConf
where TConfiguration : where TConfiguration :
class class
{ {
public async Task Initialize() public Task Initialize()
{ {
if (!reader.TryRead(out TConfiguration? configuration)) if (!reader.TryRead(out TConfiguration? configuration))
{ {
@@ -20,6 +20,7 @@ public class ConfigurationInitializer<TConfiguration>(IConfigurationReader<TConf
} }
} }
await publisher.PublishUI(new ActivatedEventArgs<TConfiguration>(configuration)); publisher.PublishUI(new ActivatedEventArgs<TConfiguration>(configuration));
return Task.CompletedTask;
} }
} }
+2 -2
View File
@@ -11,12 +11,12 @@ public class ConfigurationMonitor<TConfiguration>(IConfigurationFile<TConfigurat
public Task StartAsync(CancellationToken cancellationToken) public Task StartAsync(CancellationToken cancellationToken)
{ {
async void ChangedHandler(object sender, void ChangedHandler(object sender,
FileSystemEventArgs args) FileSystemEventArgs args)
{ {
if (reader.Read() is { } configuration) if (reader.Read() is { } configuration)
{ {
await publisher.PublishUI(new ChangedEventArgs<TConfiguration>(configuration)); publisher.PublishUI(new ChangedEventArgs<TConfiguration>(configuration));
} }
} }
+3 -3
View File
@@ -2,8 +2,8 @@
public interface INavigationScope public interface INavigationScope
{ {
Task NavigateAsync(string route, object? sender = null, object? context = null, void Navigate(string route, object? sender = null, object? context = null,
EventHandler? navigated = null, object[]? parameters = null, CancellationToken cancellationToken = default); EventHandler? navigated = null, object[]? parameters = null);
Task NavigateBackAsync(object? context, CancellationToken cancellationToken = default); void Back(object? context);
} }
+1 -2
View File
@@ -3,6 +3,5 @@
public interface INotificationHandler<in TMessage> : public interface INotificationHandler<in TMessage> :
IHandler IHandler
{ {
Task Handle(TMessage args, Task Handle(TMessage args);
CancellationToken cancellationToken = default);
} }
+14 -22
View File
@@ -2,45 +2,37 @@
public interface IPublisher public interface IPublisher
{ {
public Task Publish<TMessage>(object key, void Publish<TMessage>(object key)
CancellationToken cancellationToken = default)
where TMessage : new(); where TMessage : new();
public Task Publish<TMessage>(TMessage message, void Publish<TMessage>(TMessage message)
CancellationToken cancellationToken = default)
where TMessage : notnull; where TMessage : notnull;
public Task Publish<TMessage>(TMessage message, void Publish<TMessage>(TMessage message,
object key, object key)
CancellationToken cancellationToken = default)
where TMessage : notnull; where TMessage : notnull;
Task PublishUI<TMessage>(TMessage message, void PublishUI<TMessage>(TMessage message,
object key, object key)
CancellationToken cancellationToken = default)
where TMessage : notnull; where TMessage : notnull;
Task PublishUI<TMessage>(object key, void PublishUI<TMessage>(object key)
CancellationToken cancellationToken = default)
where TMessage : new(); where TMessage : new();
Task PublishUI<TMessage>(TMessage message, void PublishUI<TMessage>(TMessage message)
CancellationToken cancellationToken = default)
where TMessage : notnull; where TMessage : notnull;
Task PublishUI(object message, void PublishUI(object message);
CancellationToken cancellationToken = default);
Task Publish(object message, void Publish(object message,
Func<Func<Task>, Task> marshal, Func<Func<Task>, Task> marshal,
object? key = null, object? key = null);
CancellationToken cancellationToken = default);
Task PublishUI<TMessage>(CancellationToken cancellationToken = default) void PublishUI<TMessage>()
where TMessage : new(); where TMessage : new();
Task Publish<TMessage>(CancellationToken cancellationToken = default) void Publish<TMessage>()
where TMessage : new(); where TMessage : new();
public Task Publish(object message, CancellationToken cancellationToken = default); void Publish(object message);
} }
+4 -3
View File
@@ -5,16 +5,17 @@ namespace Toolkit.Foundation;
public class NavigateBackHandler(IComponentScopeProvider provider) : public class NavigateBackHandler(IComponentScopeProvider provider) :
INotificationHandler<NavigateBackEventArgs> INotificationHandler<NavigateBackEventArgs>
{ {
public async Task Handle(NavigateBackEventArgs args, public Task Handle(NavigateBackEventArgs args)
CancellationToken cancellationToken)
{ {
if (provider.Get(args.Scope ?? "Root") if (provider.Get(args.Scope ?? "Root")
is ComponentScopeDescriptor descriptor) is ComponentScopeDescriptor descriptor)
{ {
if (descriptor?.Services?.GetService<INavigationScope>() is INavigationScope navigationScope) if (descriptor?.Services?.GetService<INavigationScope>() is INavigationScope navigationScope)
{ {
await navigationScope.NavigateBackAsync(args.Context, cancellationToken); navigationScope.Back(args.Context);
} }
} }
return Task.CompletedTask;
} }
} }
+5 -7
View File
@@ -7,8 +7,7 @@ public class NavigateHandler(NamedComponent scope,
IServiceProvider provider) : IServiceProvider provider) :
INotificationHandler<NavigateEventArgs> INotificationHandler<NavigateEventArgs>
{ {
public async Task Handle(NavigateEventArgs args, public Task Handle(NavigateEventArgs args)
CancellationToken cancellationToken)
{ {
INavigationScope? navigationScope; INavigationScope? navigationScope;
if (args.Scope == "self") if (args.Scope == "self")
@@ -21,10 +20,9 @@ public class NavigateHandler(NamedComponent scope,
navigationScope = descriptor?.Services?.GetRequiredService<INavigationScope>(); navigationScope = descriptor?.Services?.GetRequiredService<INavigationScope>();
} }
if (navigationScope is not null) navigationScope?.Navigate(args.Route, args.Sender,
{ args.Context, args.Navigated, args.Parameters);
await navigationScope.NavigateAsync(args.Route, args.Sender,
args.Context, args.Navigated, args.Parameters, cancellationToken); return Task.CompletedTask;
}
} }
} }
+5 -6
View File
@@ -10,8 +10,8 @@ public class NavigationScope(IPublisher publisher,
IContentTemplateDescriptorProvider contentTemplateDescriptorProvider) : IContentTemplateDescriptorProvider contentTemplateDescriptorProvider) :
INavigationScope INavigationScope
{ {
public async Task NavigateAsync(string route, object? sender = null, object? context = null, public void Navigate(string route, object? sender = null, object? context = null,
EventHandler? navigated = null, object[]? parameters = null, CancellationToken cancellationToken = default) EventHandler? navigated = null, object[]? parameters = null)
{ {
string[] segments = route.Split('/'); string[] segments = route.Split('/');
int segmentCount = segments.Length; int segmentCount = segments.Length;
@@ -65,7 +65,7 @@ public class NavigationScope(IPublisher publisher,
Type navigateType = typeof(NavigateEventArgs<>).MakeGenericType(navigation.Type); Type navigateType = typeof(NavigateEventArgs<>).MakeGenericType(navigation.Type);
if (Activator.CreateInstance(navigateType, [context, view, viewModel, sender, parameters]) is object navigate) if (Activator.CreateInstance(navigateType, [context, view, viewModel, sender, parameters]) is object navigate)
{ {
await publisher.Publish(navigate, cancellationToken); publisher.Publish(navigate);
if (currentSegmentIndex == segmentCount) if (currentSegmentIndex == segmentCount)
{ {
navigated?.Invoke(this, EventArgs.Empty); navigated?.Invoke(this, EventArgs.Empty);
@@ -79,8 +79,7 @@ public class NavigationScope(IPublisher publisher,
} }
} }
public async Task NavigateBackAsync(object? context, public void Back(object? context)
CancellationToken cancellationToken = default)
{ {
if (context is not null) if (context is not null)
{ {
@@ -95,7 +94,7 @@ public class NavigationScope(IPublisher publisher,
Type navigateType = typeof(NavigateBackEventArgs<>).MakeGenericType(navigation.Type); Type navigateType = typeof(NavigateBackEventArgs<>).MakeGenericType(navigation.Type);
if (Activator.CreateInstance(navigateType, [context]) is object navigate) if (Activator.CreateInstance(navigateType, [context]) is object navigate)
{ {
await publisher.Publish(navigate, cancellationToken); publisher.Publish(navigate);
} }
} }
} }
@@ -1,4 +1,3 @@
namespace Toolkit.Foundation; namespace Toolkit.Foundation;
public delegate Task NotificationHandlerDelegate<TMessage>(TMessage message, public delegate Task NotificationHandlerDelegate<TMessage>(TMessage message);
CancellationToken cancellationToken);
@@ -6,19 +6,18 @@ public class NotificationHandlerWrapper<TMessage>(INotificationHandler<TMessage>
private readonly IEnumerable<IPipelineBehaviour<TMessage>> pipelineBehaviours = private readonly IEnumerable<IPipelineBehaviour<TMessage>> pipelineBehaviours =
pipelineBehaviours.Reverse(); pipelineBehaviours.Reverse();
public async Task Handle(TMessage message, public async Task Handle(TMessage message)
CancellationToken cancellationToken)
{ {
NotificationHandlerDelegate<TMessage> currentHandler = handler.Handle; NotificationHandlerDelegate<TMessage> currentHandler = handler.Handle;
foreach (IPipelineBehaviour<TMessage> behaviour in pipelineBehaviours) foreach (IPipelineBehaviour<TMessage> behaviour in pipelineBehaviours)
{ {
NotificationHandlerDelegate<TMessage> previousHandler = currentHandler; NotificationHandlerDelegate<TMessage> previousHandler = currentHandler;
currentHandler = async (args, token) => currentHandler = async (args) =>
{ {
await behaviour.Handle(args, previousHandler, token); await behaviour.Handle(args, previousHandler);
}; };
} }
await currentHandler(message, cancellationToken); await currentHandler(message);
} }
} }
@@ -235,7 +235,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
Disposer.Dispose(this); Disposer.Dispose(this);
} }
public async Task Enumerate() public void Enumerate()
{ {
if (this.GetAttribute<EnumerateAttribute>() is EnumerateAttribute attribute) if (this.GetAttribute<EnumerateAttribute>() is EnumerateAttribute attribute)
{ {
@@ -245,7 +245,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
} }
object? key = this.GetPropertyValue(() => attribute.Key) is { } value ? value : attribute.Key; object? key = this.GetPropertyValue(() => attribute.Key) is { } value ? value : attribute.Key;
await Publisher.PublishUI(PrepareEnumeration(key)); Publisher.PublishUI(PrepareEnumeration(key));
} }
} }
@@ -255,8 +255,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
IEnumerator IEnumerable.GetEnumerator() => IEnumerator IEnumerable.GetEnumerator() =>
((IEnumerable)collection).GetEnumerator(); ((IEnumerable)collection).GetEnumerator();
public Task Handle(RemoveEventArgs<TViewModel> args, public Task Handle(RemoveEventArgs<TViewModel> args)
CancellationToken cancellationToken)
{ {
foreach (TViewModel item in this.ToList()) foreach (TViewModel item in this.ToList())
{ {
@@ -269,8 +268,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(CreateEventArgs<TViewModel> args, public Task Handle(CreateEventArgs<TViewModel> args)
CancellationToken cancellationToken)
{ {
if (args.Value is TViewModel item) if (args.Value is TViewModel item)
{ {
@@ -280,8 +278,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(InsertEventArgs<TViewModel> args, public Task Handle(InsertEventArgs<TViewModel> args)
CancellationToken cancellationToken)
{ {
if (args.Value is TViewModel item) if (args.Value is TViewModel item)
{ {
@@ -291,8 +288,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(MoveEventArgs<TViewModel> args, public Task Handle(MoveEventArgs<TViewModel> args)
CancellationToken cancellationToken)
{ {
if (args.Value is TViewModel item) if (args.Value is TViewModel item)
{ {
@@ -302,8 +298,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(ReplaceEventArgs<TViewModel> args, public Task Handle(ReplaceEventArgs<TViewModel> args)
CancellationToken cancellationToken)
{ {
if (args.Value is TViewModel item) if (args.Value is TViewModel item)
{ {
@@ -328,7 +323,7 @@ public partial class ObservableCollectionViewModel<TViewModel> :
} }
Initialized = true; Initialized = true;
await Enumerate(); Enumerate();
} }
public void Insert(int index, TViewModel item) => public void Insert(int index, TViewModel item) =>
+28 -48
View File
@@ -8,29 +8,21 @@ public class Publisher(ISubscriptionManager subscriptionManager,
IDispatcher dispatcher) : IDispatcher dispatcher) :
IPublisher IPublisher
{ {
public Task Publish<TMessage>(object key, public void Publish<TMessage>(object key)
CancellationToken cancellationToken = default)
where TMessage : new() => where TMessage : new() =>
Publish(new TMessage(), async args => await args(), Publish(new TMessage(), async args => await args(), key);
key, cancellationToken);
public Task Publish<TMessage>(TMessage message, public void Publish<TMessage>(TMessage message)
CancellationToken cancellationToken = default)
where TMessage : notnull => where TMessage : notnull =>
Publish(message, async args => await args(), Publish(message, async args => await args(), null);
null, cancellationToken);
public Task Publish<TMessage>(TMessage message, public void Publish<TMessage>(TMessage message, object key)
object key, where TMessage : notnull =>
CancellationToken cancellationToken = default) Publish(message, async args => await args(), key);
where TMessage : notnull =>
Publish(message, async args => await args(),
key, cancellationToken);
public async Task Publish(object message, public void Publish(object message,
Func<Func<Task>, Task> marshal, Func<Func<Task>, Task> marshal,
object? key = null, object? key = null)
CancellationToken cancellationToken = default)
{ {
Type notificationType = message.GetType(); Type notificationType = message.GetType();
@@ -49,53 +41,41 @@ public class Publisher(ISubscriptionManager subscriptionManager,
{ {
Type? handlerType = handler.GetType(); Type? handlerType = handler.GetType();
MethodInfo? handleMethod = handlerType.GetMethod("Handle", MethodInfo? handleMethod = handlerType.GetMethod("Handle",
[notificationType, typeof(CancellationToken)]); [notificationType]);
if (handleMethod is not null) if (handleMethod is not null)
{ {
await marshal(() => (Task)handleMethod.Invoke(handler, new object[] marshal(() => (Task)handleMethod.Invoke(handler, new object[]
{ message, cancellationToken })!); { message })!);
} }
} }
} }
} }
public Task Publish(object message, public void Publish(object message) => Publish(message,
CancellationToken cancellationToken = default) => Publish(message, async args => await args(), null);
async args => await args(),
null, cancellationToken);
public Task Publish<TMessage>(CancellationToken cancellationToken = default) public void Publish<TMessage>()
where TMessage : new() => where TMessage : new() =>
Publish(new TMessage(), async args => await args(), Publish(new TMessage(), async args => await args(), null);
null, cancellationToken);
public Task PublishUI<TMessage>(object key, public void PublishUI<TMessage>(object key)
CancellationToken cancellationToken = default) where TMessage : new() =>
where TMessage : new() => Publish(new TMessage(), args => dispatcher.Invoke(async () => await args()), key);
Publish(new TMessage(), args => dispatcher.Invoke(async () => await args()),
key, cancellationToken);
public Task PublishUI<TMessage>(TMessage message, public void PublishUI<TMessage>(TMessage message)
CancellationToken cancellationToken = default)
where TMessage : notnull => where TMessage : notnull =>
Publish(message, args => dispatcher.Invoke(async () => await args()), Publish(message, args => dispatcher.Invoke(async () => await args()), null);
null, cancellationToken);
public Task PublishUI<TMessage>(TMessage message, public void PublishUI<TMessage>(TMessage message,
object key, object key)
CancellationToken cancellationToken = default)
where TMessage : notnull => where TMessage : notnull =>
Publish(message, args => dispatcher.Invoke(async () => await args()), Publish(message, args => dispatcher.Invoke(async () => await args()), key);
key, cancellationToken);
public Task PublishUI<TMessage>(CancellationToken cancellationToken = default) public void PublishUI<TMessage>()
where TMessage : new() => where TMessage : new() =>
Publish(new TMessage(), args => dispatcher.Invoke(async () => await args()), Publish(new TMessage(), args => dispatcher.Invoke(async () => await args()), null);
null, cancellationToken);
public Task PublishUI(object message, public void PublishUI(object message) => Publish(message, args =>
CancellationToken cancellationToken = default) => Publish(message, args => dispatcher.Invoke(async () => await args()), null);
dispatcher.Invoke(async () => await args()),
null, cancellationToken);
} }
+2 -2
View File
@@ -74,8 +74,8 @@ public class NavigateAction :
ParameterBindings.Select(binding => new KeyValuePair<string, object>(binding.Key, binding.Value)).ToArray() : ParameterBindings.Select(binding => new KeyValuePair<string, object>(binding.Key, binding.Value)).ToArray() :
Enumerable.Empty<KeyValuePair<string, object>>()]; Enumerable.Empty<KeyValuePair<string, object>>()];
observableViewModel.Publisher.Publish(new NavigateEventArgs(Route, Context == this ? control : Context, Scope ?? null, observableViewModel.Publisher.Publish(new NavigateEventArgs(Route, Context == this ? control : Context, Scope ?? null,
control.DataContext, Navigated, parameters)).ConfigureAwait(false); control.DataContext, Navigated, parameters));
} }
} }
+1 -1
View File
@@ -35,7 +35,7 @@ public class NavigateBackAction :
if (control.DataContext is IObservableViewModel observableViewModel) if (control.DataContext is IObservableViewModel observableViewModel)
{ {
observableViewModel.Publisher.Publish(new NavigateBackEventArgs(Context observableViewModel.Publisher.Publish(new NavigateBackEventArgs(Context
?? null, Scope ?? null)).ConfigureAwait(false); ?? null, Scope ?? null));
} }
} }