WIn_RustTools/RustTools/Activation/DefaultActivationHandler.cs

29 lines
852 B
C#
Raw Normal View History

2024-07-14 11:24:10 +00:00
using Microsoft.UI.Xaml;
using RustTools.Contracts.Services;
using RustTools.ViewModels;
namespace RustTools.Activation;
public class DefaultActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
{
private readonly INavigationService _navigationService;
public DefaultActivationHandler(INavigationService navigationService)
{
_navigationService = navigationService;
}
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
{
// None of the ActivationHandlers has handled the activation.
return _navigationService.Frame?.Content == null;
}
protected async override Task HandleInternalAsync(LaunchActivatedEventArgs args)
{
2024-07-15 05:22:53 +00:00
_navigationService.NavigateTo(typeof(HomePageViewModel).FullName!, args.Arguments);
2024-07-14 11:24:10 +00:00
await Task.CompletedTask;
}
}