ui/winui/App.xaml.cpp

branch
newapi
changeset 205
b1ac0dd1d38b
child 209
770b3548906c
equal deleted inserted replaced
204:4a258d47f964 205:b1ac0dd1d38b
1 // Copyright (c) Microsoft Corporation and Contributors.
2 // Licensed under the MIT License.
3
4 #include "pch.h"
5
6 #include "App.xaml.h"
7 #include "MainWindow.xaml.h"
8
9 using namespace winrt;
10 using namespace Windows::Foundation;
11 using namespace Microsoft::UI::Xaml;
12 using namespace Microsoft::UI::Xaml::Controls;
13 using namespace Microsoft::UI::Xaml::Navigation;
14 using namespace winui;
15 using namespace winui::implementation;
16
17 // To learn more about WinUI, the WinUI project structure,
18 // and more about our project templates, see: http://aka.ms/winui-project-info.
19
20 /// <summary>
21 /// Initializes the singleton application object. This is the first line of authored code
22 /// executed, and as such is the logical equivalent of main() or WinMain().
23 /// </summary>
24 App::App()
25 {
26 InitializeComponent();
27
28 #if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
29 UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
30 {
31 if (IsDebuggerPresent())
32 {
33 auto errorMessage = e.Message();
34 __debugbreak();
35 }
36 });
37 #endif
38 }
39
40 /// <summary>
41 /// Invoked when the application is launched.
42 /// </summary>
43 /// <param name="e">Details about the launch request and process.</param>
44 void App::OnLaunched(LaunchActivatedEventArgs const&)
45 {
46 window = make<MainWindow>();
47 window.Activate();
48 }

mercurial