99using System . Text ;
1010using Windows . ApplicationModel . Activation ;
1111using Windows . Storage ;
12- using static Files . App . Helpers . Win32PInvoke ;
1312
1413namespace Files . App
1514{
@@ -21,9 +20,6 @@ namespace Files.App
2120 /// </remarks>
2221 internal sealed class Program
2322 {
24- private const uint CWMO_DEFAULT = 0 ;
25- private const uint INFINITE = 0xFFFFFFFF ;
26-
2723 public static Semaphore ? Pool { get ; set ; }
2824
2925 static Program ( )
@@ -250,20 +246,7 @@ private static async void OnActivated(object? sender, AppActivationArguments arg
250246 /// </remarks>
251247 public static void RedirectActivationTo ( AppInstance keyInstance , AppActivationArguments args )
252248 {
253- IntPtr eventHandle = CreateEvent ( IntPtr . Zero , true , false , null ) ;
254-
255- Task . Run ( ( ) =>
256- {
257- keyInstance . RedirectActivationToAsync ( args ) . AsTask ( ) . Wait ( ) ;
258- SetEvent ( eventHandle ) ;
259- } ) ;
260-
261- _ = CoWaitForMultipleObjects (
262- CWMO_DEFAULT ,
263- INFINITE ,
264- 1 ,
265- [ eventHandle ] ,
266- out uint handleIndex ) ;
249+ keyInstance . RedirectActivationToAsync ( args ) . AsTask ( ) . Wait ( ) ;
267250 }
268251
269252 public static void OpenShellCommandInExplorer ( string shellCommand , int pid )
@@ -273,20 +256,7 @@ public static void OpenShellCommandInExplorer(string shellCommand, int pid)
273256
274257 public static void OpenFileFromTile ( string filePath )
275258 {
276- IntPtr eventHandle = CreateEvent ( IntPtr . Zero , true , false , null ) ;
277-
278- Task . Run ( ( ) =>
279- {
280- LaunchHelper . LaunchAppAsync ( filePath , null , null ) . Wait ( ) ;
281- SetEvent ( eventHandle ) ;
282- } ) ;
283-
284- _ = CoWaitForMultipleObjects (
285- CWMO_DEFAULT ,
286- INFINITE ,
287- 1 ,
288- [ eventHandle ] ,
289- out uint handleIndex ) ;
259+ LaunchHelper . LaunchAppAsync ( filePath , null , null ) . Wait ( ) ;
290260 }
291261 }
292262}
0 commit comments