| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | using Microsoft.UI.Xaml; |
| 4 | using WslSettings.Contracts.Services; |
| 5 | using WslSettings.ViewModels.Settings; |
| 6 | |
| 7 | namespace WslSettings.Activation; |
| 8 | |
| 9 | public class DefaultActivationHandler : ActivationHandler<LaunchActivatedEventArgs> |
| 10 | { |
| 11 | public DefaultActivationHandler(INavigationService navigationService) : base(navigationService) |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | protected override bool CanHandleInternal(LaunchActivatedEventArgs args) |
| 16 | { |
| 17 | // None of the ActivationHandlers has handled the activation. |
| 18 | return _navigationService.Frame?.Content == null; |
| 19 | } |
| 20 | |
| 21 | protected async override Task HandleInternalAsync(LaunchActivatedEventArgs args) |
| 22 | { |
| 23 | Navigate(IWindowService.WindowId.MainWindow, typeof(MemAndProcViewModel).FullName!, args); |
| 24 | |
| 25 | await Task.CompletedTask; |
| 26 | } |
| 27 | } |