Skip to content

Commit a27409f

Browse files
committed
here we go again with UWP...for real this time! Very early but a few early issues dealt with [skip ci]
1 parent 909cb5c commit a27409f

File tree

71 files changed

+31626
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+31626
-6
lines changed

MainDemo.Uwp/App.xaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Application
2+
x:Class="MainDemo.Uwp.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:MainDemo.Uwp"
6+
RequestedTheme="Light">
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<ResourceDictionary Source="ms-appx:///MaterialDesignThemes.Uwp/Themes/MaterialDesign.xaml" />
11+
<ResourceDictionary Source="ms-appx:///MaterialDesignThemes.Uwp/Themes/MaterialDesignColor.Indigo.Named.xaml" />
12+
</ResourceDictionary.MergedDictionaries>
13+
14+
<ResourceDictionary.ThemeDictionaries>
15+
<ResourceDictionary x:Key="Light">
16+
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource IndigoPrimary900}"/>
17+
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource IndigoPrimary300Foreground}"/>
18+
</ResourceDictionary>
19+
</ResourceDictionary.ThemeDictionaries>
20+
21+
22+
23+
24+
</ResourceDictionary>
25+
</Application.Resources>
26+
</Application>

MainDemo.Uwp/App.xaml.cs

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.ApplicationModel;
7+
using Windows.ApplicationModel.Activation;
8+
using Windows.Foundation;
9+
using Windows.Foundation.Collections;
10+
using Windows.UI.Xaml;
11+
using Windows.UI.Xaml.Controls;
12+
using Windows.UI.Xaml.Controls.Primitives;
13+
using Windows.UI.Xaml.Data;
14+
using Windows.UI.Xaml.Input;
15+
using Windows.UI.Xaml.Media;
16+
using Windows.UI.Xaml.Navigation;
17+
18+
namespace MainDemo.Uwp
19+
{
20+
/// <summary>
21+
/// Provides application-specific behavior to supplement the default Application class.
22+
/// </summary>
23+
sealed partial class App : Application
24+
{
25+
/// <summary>
26+
/// Initializes the singleton application object. This is the first line of authored code
27+
/// executed, and as such is the logical equivalent of main() or WinMain().
28+
/// </summary>
29+
public App()
30+
{
31+
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
32+
Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
33+
Microsoft.ApplicationInsights.WindowsCollectors.Session);
34+
this.InitializeComponent();
35+
this.Suspending += OnSuspending;
36+
}
37+
38+
/// <summary>
39+
/// Invoked when the application is launched normally by the end user. Other entry points
40+
/// will be used such as when the application is launched to open a specific file.
41+
/// </summary>
42+
/// <param name="e">Details about the launch request and process.</param>
43+
protected override void OnLaunched(LaunchActivatedEventArgs e)
44+
{
45+
46+
#if DEBUG
47+
if (System.Diagnostics.Debugger.IsAttached)
48+
{
49+
this.DebugSettings.EnableFrameRateCounter = true;
50+
}
51+
#endif
52+
53+
Frame rootFrame = Window.Current.Content as Frame;
54+
55+
// Do not repeat app initialization when the Window already has content,
56+
// just ensure that the window is active
57+
if (rootFrame == null)
58+
{
59+
// Create a Frame to act as the navigation context and navigate to the first page
60+
rootFrame = new Frame();
61+
62+
rootFrame.NavigationFailed += OnNavigationFailed;
63+
64+
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
65+
{
66+
//TODO: Load state from previously suspended application
67+
}
68+
69+
// Place the frame in the current Window
70+
Window.Current.Content = rootFrame;
71+
}
72+
73+
if (rootFrame.Content == null)
74+
{
75+
// When the navigation stack isn't restored navigate to the first page,
76+
// configuring the new page by passing required information as a navigation
77+
// parameter
78+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
79+
}
80+
// Ensure the current window is active
81+
Window.Current.Activate();
82+
}
83+
84+
/// <summary>
85+
/// Invoked when Navigation to a certain page fails
86+
/// </summary>
87+
/// <param name="sender">The Frame which failed navigation</param>
88+
/// <param name="e">Details about the navigation failure</param>
89+
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
90+
{
91+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
92+
}
93+
94+
/// <summary>
95+
/// Invoked when application execution is being suspended. Application state is saved
96+
/// without knowing whether the application will be terminated or resumed with the contents
97+
/// of memory still intact.
98+
/// </summary>
99+
/// <param name="sender">The source of the suspend request.</param>
100+
/// <param name="e">Details about the suspend request.</param>
101+
private void OnSuspending(object sender, SuspendingEventArgs e)
102+
{
103+
var deferral = e.SuspendingOperation.GetDeferral();
104+
//TODO: Save application state and stop any background activity
105+
deferral.Complete();
106+
}
107+
}
108+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ApplicationInsights xmlns = "http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
3+
</ApplicationInsights>
1.4 KB
Loading
7.52 KB
Loading
2.87 KB
Loading
1.61 KB
Loading
1.23 KB
Loading

MainDemo.Uwp/Assets/StoreLogo.png

1.42 KB
Loading
3.13 KB
Loading

0 commit comments

Comments
 (0)