Add chapter 10 sample project

This commit is contained in:
Alvin Ashcraft
2023-08-13 13:40:04 -04:00
parent f9e4d407b9
commit 90f935f4b2
91 changed files with 4110 additions and 0 deletions
@@ -0,0 +1,29 @@
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;
}
}