@@ -22,6 +22,8 @@ public class ShellFilesystemOperations : IFilesystemOperations
22
22
23
23
private IShellPage associatedInstance ;
24
24
25
+ private long parentWindow ;
26
+
25
27
private FilesystemOperations filesystemOperations ;
26
28
27
29
private RecycleBinHelpers recycleBinHelpers ;
@@ -30,9 +32,10 @@ public class ShellFilesystemOperations : IFilesystemOperations
30
32
31
33
#region Constructor
32
34
33
- public ShellFilesystemOperations ( IShellPage associatedInstance )
35
+ public ShellFilesystemOperations ( IShellPage associatedInstance , long parentWindow )
34
36
{
35
37
this . associatedInstance = associatedInstance ;
38
+ this . parentWindow = parentWindow ;
36
39
filesystemOperations = new FilesystemOperations ( associatedInstance ) ;
37
40
recycleBinHelpers = new RecycleBinHelpers ( ) ;
38
41
}
@@ -95,7 +98,7 @@ public async Task<IStorageHistory> CopyItemsAsync(IEnumerable<IStorageItemWithPa
95
98
{ "filepath" , string . Join ( '|' , sourceRename . Select ( s => s . Path ) ) } ,
96
99
{ "destpath" , string . Join ( '|' , destinationRename ) } ,
97
100
{ "overwrite" , false } ,
98
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
101
+ { "HWND" , parentWindow }
99
102
} ) ;
100
103
result &= ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
101
104
&& response . Get ( "Success" , false ) ) ;
@@ -112,7 +115,7 @@ public async Task<IStorageHistory> CopyItemsAsync(IEnumerable<IStorageItemWithPa
112
115
{ "filepath" , string . Join ( '|' , sourceReplace . Select ( s => s . Path ) ) } ,
113
116
{ "destpath" , string . Join ( '|' , destinationReplace ) } ,
114
117
{ "overwrite" , true } ,
115
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
118
+ { "HWND" , parentWindow }
116
119
} ) ;
117
120
result &= ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
118
121
&& response . Get ( "Success" , false ) ) ;
@@ -247,7 +250,7 @@ public async Task<IStorageHistory> DeleteItemsAsync(IEnumerable<IStorageItemWith
247
250
{ "operationID" , operationID } ,
248
251
{ "filepath" , string . Join ( '|' , deleleFilePaths ) } ,
249
252
{ "permanently" , permanently } ,
250
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
253
+ { "HWND" , parentWindow }
251
254
} ) ;
252
255
var result = ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
253
256
&& response . Get ( "Success" , false ) ) ;
@@ -265,10 +268,6 @@ public async Task<IStorageHistory> DeleteItemsAsync(IEnumerable<IStorageItemWith
265
268
{
266
269
progress ? . Report ( 100.0f ) ;
267
270
errorCode ? . Report ( FileSystemStatusCode . Success ) ;
268
- foreach ( var item in deleteResult . Items )
269
- {
270
- await associatedInstance . FilesystemViewModel . RemoveFileOrFolderAsync ( item . Source ) ;
271
- }
272
271
var recycledSources = deleteResult . Items . Where ( x => x . Succeeded && x . Destination != null && x . Source != x . Destination )
273
272
. Where ( x => source . Select ( s => s . Path ) . Contains ( x . Source ) ) ;
274
273
if ( recycledSources . Any ( ) )
@@ -345,7 +344,7 @@ public async Task<IStorageHistory> MoveItemsAsync(IEnumerable<IStorageItemWithPa
345
344
{ "filepath" , string . Join ( '|' , sourceRename . Select ( s => s . Path ) ) } ,
346
345
{ "destpath" , string . Join ( '|' , destinationRename ) } ,
347
346
{ "overwrite" , false } ,
348
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
347
+ { "HWND" , parentWindow }
349
348
} ) ;
350
349
result &= ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
351
350
&& response . Get ( "Success" , false ) ) ;
@@ -362,7 +361,7 @@ public async Task<IStorageHistory> MoveItemsAsync(IEnumerable<IStorageItemWithPa
362
361
{ "filepath" , string . Join ( '|' , sourceReplace . Select ( s => s . Path ) ) } ,
363
362
{ "destpath" , string . Join ( '|' , destinationReplace ) } ,
364
363
{ "overwrite" , true } ,
365
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
364
+ { "HWND" , parentWindow }
366
365
} ) ;
367
366
result &= ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
368
367
&& response . Get ( "Success" , false ) ) ;
@@ -489,7 +488,7 @@ public async Task<IStorageHistory> RestoreItemsFromTrashAsync(IEnumerable<IStora
489
488
{ "filepath" , string . Join ( '|' , source . Select ( s => s . Path ) ) } ,
490
489
{ "destpath" , string . Join ( '|' , destination ) } ,
491
490
{ "overwrite" , false } ,
492
- { "HWND" , NativeWinApiHelper . CoreWindowHandle . ToInt64 ( ) }
491
+ { "HWND" , parentWindow }
493
492
} ) ;
494
493
var result = ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
495
494
&& response . Get ( "Success" , false ) ) ;
0 commit comments