#include "pch.h" #include "App.h" #include "AutolinkedNativeModules.g.h" #include "ReactPackageProvider.h" using namespace winrt::videoplayer; using namespace winrt::videoplayer::implementation; using namespace winrt; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Navigation; using namespace Windows::ApplicationModel; /// /// Initializes the singleton application object. This is the first line of /// authored code executed, and as such is the logical equivalent of main() or /// WinMain(). /// App::App() noexcept { #if BUNDLE JavaScriptBundleFile(L"src/index.windows"); InstanceSettings().UseWebDebugger(false); InstanceSettings().UseFastRefresh(false); #else JavaScriptMainModuleName(L"src/index"); InstanceSettings().UseWebDebugger(true); InstanceSettings().UseFastRefresh(true); #endif #if _DEBUG InstanceSettings().UseDeveloperSupport(true); #else InstanceSettings().UseDeveloperSupport(false); #endif RegisterAutolinkedNativeModulePackages(PackageProviders()); // Includes any autolinked modules PackageProviders().Append(make()); // Includes all modules in this project InitializeComponent(); } /// /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// /// Details about the launch request and process. void App::OnLaunched(activation::LaunchActivatedEventArgs const& e) { super::OnLaunched(e); Frame rootFrame = Window::Current().Content().as(); rootFrame.Navigate(xaml_typename(), box_value(e.Arguments())); } /// /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// /// The source of the suspend request. /// Details about the suspend request. void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e) { // Save application state and stop any background activity } /// /// Invoked when Navigation to a certain page fails /// /// The Frame which failed navigation /// Details about the navigation failure void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e) { throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name); }