123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
-
- #include "pch.h"
- #include "MainPage.xaml.h"
- using namespace VSXaml;
- using namespace Platform;
- using namespace Windows::ApplicationModel;
- using namespace Windows::ApplicationModel::Activation;
- using namespace Windows::Foundation;
- using namespace Windows::Foundation::Collections;
- using namespace Windows::UI::Xaml;
- using namespace Windows::UI::Xaml::Controls;
- using namespace Windows::UI::Xaml::Controls::Primitives;
- using namespace Windows::UI::Xaml::Data;
- using namespace Windows::UI::Xaml::Input;
- using namespace Windows::UI::Xaml::Interop;
- using namespace Windows::UI::Xaml::Media;
- using namespace Windows::UI::Xaml::Navigation;
- App::App()
- {
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
- }
- void App::OnLaunched(
- Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ e)
- {
- #if _DEBUG
-
- if (IsDebuggerPresent()) {
-
- DebugSettings->EnableFrameRateCounter = true;
- }
- #endif
- auto rootFrame = dynamic_cast<Frame ^>(Window::Current->Content);
-
-
- if (rootFrame == nullptr) {
-
-
- rootFrame = ref new Frame();
-
- rootFrame->Language =
- Windows::Globalization::ApplicationLanguages::Languages->GetAt(0);
- rootFrame->NavigationFailed +=
- ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(
- this, &App::OnNavigationFailed);
- if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) {
-
-
-
- }
- if (rootFrame->Content == nullptr) {
-
-
-
-
- rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
- }
-
- Window::Current->Content = rootFrame;
-
- Window::Current->Activate();
- } else {
- if (rootFrame->Content == nullptr) {
-
-
-
-
- rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
- }
-
- Window::Current->Activate();
- }
- }
- void App::OnSuspending(Object ^ sender, SuspendingEventArgs ^ e)
- {
- (void)sender;
- (void)e;
-
- }
- void App::OnNavigationFailed(
- Platform::Object ^ sender,
- Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^ e)
- {
- throw ref new FailureException("Failed to load Page " +
- e->SourcePageType.Name);
- }
|