-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
55 lines (44 loc) · 1.5 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using HyprWinUI3.Services;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
namespace HyprWinUI3
{
public sealed partial class App : Application
{
private Lazy<ActivationService> _activationService;
private ActivationService ActivationService => _activationService.Value;
public App()
{
InitializeComponent();
UnhandledException += OnAppUnhandledException;
// Deferred execution until used. Check https://docs.microsoft.com/dotnet/api/system.lazy-1 for further info on Lazy<T> class.
_activationService = new Lazy<ActivationService>(CreateActivationService);
}
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
DebugSettings.EnableFrameRateCounter = true;
if (!args.PrelaunchActivated)
{
await ActivationService.ActivateAsync(args);
}
}
protected override async void OnActivated(IActivatedEventArgs args)
{
await ActivationService.ActivateAsync(args);
}
private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
// TODO WTS: Please log and handle the exception as appropriate to your scenario
// For more info see https://docs.microsoft.com/uwp/api/windows.ui.xaml.application.unhandledexception
}
private ActivationService CreateActivationService()
{
return new ActivationService(this, typeof(Views.TabViewPage), new Lazy<UIElement>(CreateShell));
}
private UIElement CreateShell()
{
return new Views.ShellPage();
}
}
}