Improve Publisher
This commit is contained in:
@@ -9,16 +9,18 @@ namespace Bitvault.Avalonia;
|
||||
public class AppHandler(IPublisher publisher) :
|
||||
INotificationHandler<StartedEventArgs>
|
||||
{
|
||||
public async Task Handle(StartedEventArgs args, CancellationToken cancellationToken = default)
|
||||
public Task Handle(StartedEventArgs args)
|
||||
{
|
||||
if (Application.Current is Application application)
|
||||
{
|
||||
if (application.ApplicationLifetime is IApplicationLifetime lifetime)
|
||||
{
|
||||
await publisher.Publish(new NavigateEventArgs(lifetime is IClassicDesktopStyleApplicationLifetime ? "MainWindow" : "Main",
|
||||
publisher.Publish(new NavigateEventArgs(lifetime is IClassicDesktopStyleApplicationLifetime ? "MainWindow" : "Main",
|
||||
lifetime is IClassicDesktopStyleApplicationLifetime ? typeof(IClassicDesktopStyleApplicationLifetime) :
|
||||
typeof(ISingleViewApplicationLifetime)), cancellationToken);
|
||||
typeof(ISingleViewApplicationLifetime)));
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user