forked from microsoft/CsWinRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.xaml.cs
59 lines (52 loc) · 1.45 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
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Windows.Web.Http;
namespace WinUIDesktopSample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
}
Window myWindow;
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
var value = DependencyProperty.UnsetValue;
var button = new Button
{
Content = "Click me to load MainPage",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
button.Click += Button_Click;
var window = new Microsoft.UI.Xaml.Window
{
Content = button
};
window.Activate();
myWindow = window;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
myWindow.Content = new MainPage();
}
}
public static class Program
{
static void Main(string[] args)
{
WinRT.ComWrappersSupport.InitializeComWrappers();
Microsoft.UI.Xaml.Application.Start((e) => new App());
}
}
}