diff --git a/support/hololens/ServoApp/App.cpp b/support/hololens/ServoApp/App.cpp index 8d80c800f4e..917226dc4ef 100644 --- a/support/hololens/ServoApp/App.cpp +++ b/support/hololens/ServoApp/App.cpp @@ -31,7 +31,9 @@ App::App() { #endif } -void App::OnLaunched(LaunchActivatedEventArgs const &e) { +void App::createRootFrame( + bool prelaunchActivated, + winrt::Windows::Foundation::IInspectable const &args) { Frame rootFrame{nullptr}; auto content = Window::Current().Content(); if (content) { @@ -43,26 +45,33 @@ void App::OnLaunched(LaunchActivatedEventArgs const &e) { rootFrame.NavigationFailed({this, &App::OnNavigationFailed}); - if (e.PrelaunchActivated() == false) { + if (prelaunchActivated == false) { if (rootFrame.Content() == nullptr) { - rootFrame.Navigate(xaml_typename(), - box_value(e.Arguments())); + rootFrame.Navigate(xaml_typename(), args); } Window::Current().Content(rootFrame); Window::Current().Activate(); } } else { - if (e.PrelaunchActivated() == false) { + if (prelaunchActivated == false) { if (rootFrame.Content() == nullptr) { - rootFrame.Navigate(xaml_typename(), - box_value(e.Arguments())); + rootFrame.Navigate(xaml_typename(), args); } Window::Current().Activate(); } } } +void App::OnLaunched(LaunchActivatedEventArgs const &e) { + this->createRootFrame(e.PrelaunchActivated(), box_value(e.Arguments())); +} + void App::OnActivated(IActivatedEventArgs const &args) { + if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind:: + CommandLineLaunch) { + return this->createRootFrame(false, nullptr); + } + if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind::Protocol) { auto protocolActivatedEventArgs{args.as< diff --git a/support/hololens/ServoApp/App.h b/support/hololens/ServoApp/App.h index 2c46c102d77..8abc9bc8d2e 100644 --- a/support/hololens/ServoApp/App.h +++ b/support/hololens/ServoApp/App.h @@ -9,6 +9,8 @@ namespace winrt::ServoApp::implementation { struct App : AppT { App(); + void createRootFrame(bool prelaunchActivated, + winrt::Windows::Foundation::IInspectable const &args); void OnLaunched( Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &); void App::OnActivated( diff --git a/support/hololens/ServoApp/Package.appxmanifest b/support/hololens/ServoApp/Package.appxmanifest index af3a17005e6..0a74082b073 100644 --- a/support/hololens/ServoApp/Package.appxmanifest +++ b/support/hololens/ServoApp/Package.appxmanifest @@ -1,5 +1,5 @@  - + @@ -32,6 +32,14 @@ Firefox Reality URL + + + + +