diff --git a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs index e52a08638811..0c214c2d2c49 100644 --- a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs +++ b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs @@ -68,15 +68,6 @@ public static extern bool SetEvent( IntPtr hEvent ); - [DllImport("ole32.dll")] - public static extern uint CoWaitForMultipleObjects( - uint dwFlags, - uint dwMilliseconds, - ulong nHandles, - IntPtr[] pHandles, - out uint dwIndex - ); - [DllImport("shell32.dll")] public static extern IntPtr SHBrowseForFolder( ref BROWSEINFO lpbi diff --git a/src/Files.App/Program.cs b/src/Files.App/Program.cs index 6d7807095797..13e9e9b18465 100644 --- a/src/Files.App/Program.cs +++ b/src/Files.App/Program.cs @@ -9,7 +9,6 @@ using System.Text; using Windows.ApplicationModel.Activation; using Windows.Storage; -using static Files.App.Helpers.Win32PInvoke; namespace Files.App { @@ -21,9 +20,6 @@ namespace Files.App /// internal sealed class Program { - private const uint CWMO_DEFAULT = 0; - private const uint INFINITE = 0xFFFFFFFF; - public static Semaphore? Pool { get; set; } static Program() @@ -250,20 +246,7 @@ private static async void OnActivated(object? sender, AppActivationArguments arg /// public static void RedirectActivationTo(AppInstance keyInstance, AppActivationArguments args) { - IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null); - - Task.Run(() => - { - keyInstance.RedirectActivationToAsync(args).AsTask().Wait(); - SetEvent(eventHandle); - }); - - _ = CoWaitForMultipleObjects( - CWMO_DEFAULT, - INFINITE, - 1, - [eventHandle], - out uint handleIndex); + keyInstance.RedirectActivationToAsync(args).AsTask().Wait(); } public static void OpenShellCommandInExplorer(string shellCommand, int pid) @@ -273,20 +256,7 @@ public static void OpenShellCommandInExplorer(string shellCommand, int pid) public static void OpenFileFromTile(string filePath) { - IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null); - - Task.Run(() => - { - LaunchHelper.LaunchAppAsync(filePath, null, null).Wait(); - SetEvent(eventHandle); - }); - - _ = CoWaitForMultipleObjects( - CWMO_DEFAULT, - INFINITE, - 1, - [eventHandle], - out uint handleIndex); + LaunchHelper.LaunchAppAsync(filePath, null, null).Wait(); } } }