Skip to content

Commit

Permalink
feat: Launch Bluebird from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinguin2001 committed Dec 27, 2024
1 parent 38086ae commit 89a1125
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 23 deletions.
59 changes: 36 additions & 23 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,47 @@ protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
StartupUrl = eventArgs.Uri.ToString();
Frame rootFrame = Window.Current.Content as Frame;
ProtocolActivatedEventArgs ProtocolEventArgs = args as ProtocolActivatedEventArgs;
StartupUrl = ProtocolEventArgs.Uri.ToString();
UnifiedArgumentStartup();
}

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new();
if (args.Kind == ActivationKind.CommandLineLaunch)
{
CommandLineActivatedEventArgs CommandEventArgs = args as CommandLineActivatedEventArgs;
CommandLineActivationOperation operation = CommandEventArgs.Operation;
StartupUrl = operation.Arguments;
UnifiedArgumentStartup();
}
}

rootFrame.NavigationFailed += OnNavigationFailed;
private void UnifiedArgumentStartup()
{
Frame rootFrame = Window.Current.Content as Frame;

Window.Current.Content = rootFrame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new();

SetupTitleBar();
string PasswordLock = SettingsHelper.GetSetting("PasswordLock");
if (PasswordLock == "true")
rootFrame.Navigate(typeof(LoginPage), null, new DrillInNavigationTransitionInfo());
else
rootFrame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo());
// Ensure the current window is active
Window.Current.Activate();
}
rootFrame.NavigationFailed += OnNavigationFailed;

Window.Current.Content = rootFrame;

SetupTitleBar();
string PasswordLock = SettingsHelper.GetSetting("PasswordLock");
if (PasswordLock == "true")
rootFrame.Navigate(typeof(LoginPage), null, new DrillInNavigationTransitionInfo());
else
{
MainPageContent.CreateWebTab(StartupUrl);
}
rootFrame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo());
// Ensure the current window is active
Window.Current.Activate();
}
else
{
MainPageContent.CreateWebTab(StartupUrl);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
<uap:Logo>Assets/FileIcons/link.png</uap:Logo>
</uap:Protocol>
</uap:Extension>
<uap5:Extension
Category="windows.appExecutionAlias"
Executable="Bluebird.exe"
EntryPoint="Bluebird.App">
<uap5:AppExecutionAlias>
<uap5:ExecutionAlias Alias="Bluebird.exe" />
</uap5:AppExecutionAlias>
</uap5:Extension>
</Extensions>
</Application>
</Applications>
Expand Down

0 comments on commit 89a1125

Please sign in to comment.