-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
73 lines (62 loc) · 2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Windows.UI.Xaml;
using System.Threading.Tasks;
using SJ5000Plus.Services.SettingsServices;
using Windows.ApplicationModel.Activation;
using Template10.Controls;
using Template10.Common;
using SJ5000Plus.Services.CameraServices;
using Windows.Foundation;
using System;
namespace SJ5000Plus
{
/// Documentation on APIs used in this page:
/// https://github.com/Windows-XAML/Template10/wiki
sealed partial class App : Template10.Common.BootStrapper
{
public ICameraService Camera;
public App()
{
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
Microsoft.ApplicationInsights.WindowsCollectors.Session);
InitializeComponent();
SplashFactory = (e) => new Views.Splash(e);
#region App settings
var _settings = SettingsService.Instance;
RequestedTheme = _settings.AppTheme;
CacheMaxDuration = _settings.CacheMaxDuration;
ShowShellBackButton = _settings.UseShellBackButton;
#endregion
}
// runs even if restored from state
public override Task OnInitializeAsync(IActivatedEventArgs args)
{
// content may already be shell when resuming
if ((Window.Current.Content as ModalDialog) == null)
{
// setup hamburger shell inside a modal dialog
var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);
Window.Current.Content = new ModalDialog
{
DisableBackButtonWhenModal = true,
Content = new Views.Shell(nav),
ModalContent = new Views.Busy(),
};
}
return Task.CompletedTask;
}
// runs only when not restored from state
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// Show phone statusbar
if (Windows.Foundation.Metadata.ApiInformation
.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
//await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
Windows.UI.ViewManagement.StatusBar.GetForCurrentView().BackgroundOpacity = 1;
}
NavigationService.Navigate(typeof(Views.ConnectPage));
return Task.CompletedTask;
}
}
}