mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
30 lines
891 B
C#
30 lines
891 B
C#
using Microsoft.UI.Xaml;
|
|
|
|
using TemplateStudioSampleApp.Contracts.Services;
|
|
using TemplateStudioSampleApp.ViewModels;
|
|
|
|
namespace TemplateStudioSampleApp.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)
|
|
{
|
|
_navigationService.NavigateTo(typeof(MainViewModel).FullName!, args.Arguments);
|
|
|
|
await Task.CompletedTask;
|
|
}
|
|
}
|