diff options
Diffstat (limited to 'support/hololens/ServoApp/App.cpp')
-rw-r--r-- | support/hololens/ServoApp/App.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/support/hololens/ServoApp/App.cpp b/support/hololens/ServoApp/App.cpp index 9f6495c49e1..9beeb0b9540 100644 --- a/support/hololens/ServoApp/App.cpp +++ b/support/hololens/ServoApp/App.cpp @@ -62,8 +62,29 @@ void App::OnLaunched(LaunchActivatedEventArgs const &e) { } } -void App::OnSuspending([[maybe_unused]] IInspectable const &sender, - [[maybe_unused]] SuspendingEventArgs const &e) { +void App::OnActivated(IActivatedEventArgs const &args) { + if (args.Kind() == + Windows::ApplicationModel::Activation::ActivationKind::Protocol) { + auto protocolActivatedEventArgs{args.as< + Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs>()}; + + Frame rootFrame{nullptr}; + + auto content = Window::Current().Content(); + if (content == nullptr) { + rootFrame = Frame(); + rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>()); + Window::Current().Content(rootFrame); + Window::Current().Activate(); + } else { + rootFrame = content.try_as<Frame>(); + } + auto page = rootFrame.Content().try_as<BrowserPage>(); + page->LoadServoURI(protocolActivatedEventArgs.Uri()); + } +} + +void App::OnSuspending(IInspectable const &, SuspendingEventArgs const &) { auto content = Window::Current().Content(); Frame rootFrame = content.try_as<Frame>(); auto page = rootFrame.Content().try_as<BrowserPage>(); |