mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Allow launching UWP app from command line
This commit is contained in:
parent
e26530341b
commit
0feb16fe8d
3 changed files with 27 additions and 8 deletions
|
@ -31,7 +31,9 @@ App::App() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnLaunched(LaunchActivatedEventArgs const &e) {
|
void App::createRootFrame(
|
||||||
|
bool prelaunchActivated,
|
||||||
|
winrt::Windows::Foundation::IInspectable const &args) {
|
||||||
Frame rootFrame{nullptr};
|
Frame rootFrame{nullptr};
|
||||||
auto content = Window::Current().Content();
|
auto content = Window::Current().Content();
|
||||||
if (content) {
|
if (content) {
|
||||||
|
@ -43,26 +45,33 @@ void App::OnLaunched(LaunchActivatedEventArgs const &e) {
|
||||||
|
|
||||||
rootFrame.NavigationFailed({this, &App::OnNavigationFailed});
|
rootFrame.NavigationFailed({this, &App::OnNavigationFailed});
|
||||||
|
|
||||||
if (e.PrelaunchActivated() == false) {
|
if (prelaunchActivated == false) {
|
||||||
if (rootFrame.Content() == nullptr) {
|
if (rootFrame.Content() == nullptr) {
|
||||||
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>(),
|
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>(), args);
|
||||||
box_value(e.Arguments()));
|
|
||||||
}
|
}
|
||||||
Window::Current().Content(rootFrame);
|
Window::Current().Content(rootFrame);
|
||||||
Window::Current().Activate();
|
Window::Current().Activate();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e.PrelaunchActivated() == false) {
|
if (prelaunchActivated == false) {
|
||||||
if (rootFrame.Content() == nullptr) {
|
if (rootFrame.Content() == nullptr) {
|
||||||
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>(),
|
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>(), args);
|
||||||
box_value(e.Arguments()));
|
|
||||||
}
|
}
|
||||||
Window::Current().Activate();
|
Window::Current().Activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::OnLaunched(LaunchActivatedEventArgs const &e) {
|
||||||
|
this->createRootFrame(e.PrelaunchActivated(), box_value(e.Arguments()));
|
||||||
|
}
|
||||||
|
|
||||||
void App::OnActivated(IActivatedEventArgs const &args) {
|
void App::OnActivated(IActivatedEventArgs const &args) {
|
||||||
|
if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind::
|
||||||
|
CommandLineLaunch) {
|
||||||
|
return this->createRootFrame(false, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Kind() ==
|
if (args.Kind() ==
|
||||||
Windows::ApplicationModel::Activation::ActivationKind::Protocol) {
|
Windows::ApplicationModel::Activation::ActivationKind::Protocol) {
|
||||||
auto protocolActivatedEventArgs{args.as<
|
auto protocolActivatedEventArgs{args.as<
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace winrt::ServoApp::implementation {
|
||||||
struct App : AppT<App> {
|
struct App : AppT<App> {
|
||||||
App();
|
App();
|
||||||
|
|
||||||
|
void createRootFrame(bool prelaunchActivated,
|
||||||
|
winrt::Windows::Foundation::IInspectable const &args);
|
||||||
void OnLaunched(
|
void OnLaunched(
|
||||||
Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &);
|
Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &);
|
||||||
void App::OnActivated(
|
void App::OnActivated(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap mp uap5">
|
||||||
<Identity Name="1d265729-8836-4bd3-9992-4cb111d1068b" Publisher="CN=Allizom" Version="1.0.0.0" />
|
<Identity Name="1d265729-8836-4bd3-9992-4cb111d1068b" Publisher="CN=Allizom" Version="1.0.0.0" />
|
||||||
<mp:PhoneIdentity PhoneProductId="1d265729-8836-4bd3-9992-4cb111d1068b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
<mp:PhoneIdentity PhoneProductId="1d265729-8836-4bd3-9992-4cb111d1068b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||||
<Properties>
|
<Properties>
|
||||||
|
@ -32,6 +32,14 @@
|
||||||
<uap:DisplayName>Firefox Reality URL</uap:DisplayName>
|
<uap:DisplayName>Firefox Reality URL</uap:DisplayName>
|
||||||
</uap:Protocol>
|
</uap:Protocol>
|
||||||
</uap:Extension>
|
</uap:Extension>
|
||||||
|
<uap5:Extension
|
||||||
|
Category="windows.appExecutionAlias"
|
||||||
|
Executable="ServoApp.exe"
|
||||||
|
EntryPoint="ServoApp.App">
|
||||||
|
<uap5:AppExecutionAlias>
|
||||||
|
<uap5:ExecutionAlias Alias="Servo.exe" />
|
||||||
|
</uap5:AppExecutionAlias>
|
||||||
|
</uap5:Extension>
|
||||||
</Extensions>
|
</Extensions>
|
||||||
</Application>
|
</Application>
|
||||||
</Applications>
|
</Applications>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue