Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,6 @@ msbuild.binlog
LottieGenOutput-*/

# Visual Studio debugging configuration file.
launchSettings.json
launchSettings.json

Generated Files/
21 changes: 21 additions & 0 deletions CppApp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<Application
x:Class="CppApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CppApp">

<Application.Resources>
<!-- Application-specific resources -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="ms-appx:///Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
38 changes: 38 additions & 0 deletions CppApp/App.xaml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#include "pch.h"

#include "App.xaml.h"
#include "MainWindow.xaml.h"

namespace winrt
{
using namespace Windows::Foundation;
using namespace Microsoft::UI::Xaml;
}

namespace winrt::CppApp::implementation
{
App::App()
{
InitializeComponent();

#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException([](winrt::IInspectable const&, winrt::UnhandledExceptionEventArgs const& e)
{
if (IsDebuggerPresent())
{
auto errorMessage = e.Message();
__debugbreak();
}
});
#endif
}

void App::OnLaunched(winrt::LaunchActivatedEventArgs const&)
{
window = winrt::make<MainWindow>();
window.Activate();
}
}
19 changes: 19 additions & 0 deletions CppApp/App.xaml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#pragma once
#include "App.xaml.g.h"
#include "pch.h"

namespace winrt::CppApp::implementation
{
struct App : AppT<App>
{
App();

void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&);

private:
Microsoft::UI::Xaml::Window window{ nullptr };
};
}
Loading