Skip to content

Commit

Permalink
Put back packaging support, but avoid expensive call
Browse files Browse the repository at this point in the history
  • Loading branch information
veselink1 committed Mar 24, 2024
1 parent 73cd6df commit 2f9f33b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions FancyWM/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using FancyWM.Utilities;
using System.Text;
using System.Security.Principal;
using System.Runtime.InteropServices;

namespace FancyWM
{
Expand Down Expand Up @@ -38,6 +39,29 @@ public static int Main(string[] args)
}
Directory.SetCurrentDirectory(fullPath);

bool isPackaged = false;
try
{
global::Windows.ApplicationModel.Package.Current.GetHashCode();
isPackaged = true;
}
catch (Exception)
{
}

if (isPackaged)
try
{
if (global::Windows.ApplicationModel.AppInstance.GetActivatedEventArgs() is global::Windows.ApplicationModel.Activation.CommandLineActivatedEventArgs storeAppArgs)
{
args = storeAppArgs.Operation.Arguments.Split();
}
}
catch (COMException)
{
// not a store packaged app
}

if (args.Contains("--action"))
{
ExecuteAction(args[args.IndexOf("--action") + 1]);
Expand Down

0 comments on commit 2f9f33b

Please sign in to comment.