@@ -59,8 +59,8 @@ await associatedInstance.SlimContentPage.SelectedItems.ToList().ParallelForEachA
59
59
{
60
60
_ = CoreApplication . MainView . DispatcherQueue . TryEnqueue ( Windows . System . DispatcherQueuePriority . Low , ( ) =>
61
61
{
62
- // Dim opacities accordingly
63
- listedItem . Opacity = Constants . UI . DimItemOpacity ;
62
+ // Dim opacities accordingly
63
+ listedItem . Opacity = Constants . UI . DimItemOpacity ;
64
64
} ) ;
65
65
}
66
66
if ( listedItem is FtpItem ftpItem )
@@ -329,53 +329,45 @@ public static async Task<IStorageItem> CreateFileFromDialogResultTypeForResult(A
329
329
}
330
330
331
331
// Create file based on dialog result
332
- var folderRes = await associatedInstance . FilesystemViewModel . GetFolderWithPathFromPathAsync ( currentPath ) ;
333
- var created = new FilesystemResult < ( ReturnResult , IStorageItem ) > ( ( ReturnResult . Failed , null ) , FileSystemStatusCode . Generic ) ;
334
- if ( folderRes )
332
+ ( ReturnResult Status , IStorageItem Item ) created = ( ReturnResult . Failed , null ) ;
333
+ switch ( itemType )
335
334
{
336
- switch ( itemType )
337
- {
338
- case AddItemDialogItemType . Folder :
339
- userInput = ! string . IsNullOrWhiteSpace ( userInput ) ? userInput : "NewFolder" . GetLocalized ( ) ;
340
- created = await FilesystemTasks . Wrap ( async ( ) =>
341
- {
342
- return await associatedInstance . FilesystemHelpers . CreateAsync (
343
- StorageHelpers . FromPathAndType ( PathNormalization . Combine ( folderRes . Result . Path , userInput ) , FilesystemItemType . Directory ) ,
344
- true ) ;
345
- } ) ;
346
- break ;
335
+ case AddItemDialogItemType . Folder :
336
+ userInput = ! string . IsNullOrWhiteSpace ( userInput ) ? userInput : "NewFolder" . GetLocalized ( ) ;
337
+ created = await associatedInstance . FilesystemHelpers . CreateAsync (
338
+ StorageHelpers . FromPathAndType ( PathNormalization . Combine ( currentPath , userInput ) , FilesystemItemType . Directory ) ,
339
+ true ) ;
340
+ break ;
347
341
348
- case AddItemDialogItemType . File :
349
- userInput = ! string . IsNullOrWhiteSpace ( userInput ) ? userInput : itemInfo ? . Name ?? "NewFile" . GetLocalized ( ) ;
350
- created = await FilesystemTasks . Wrap ( async ( ) =>
351
- {
352
- return await associatedInstance . FilesystemHelpers . CreateAsync (
353
- StorageHelpers . FromPathAndType ( PathNormalization . Combine ( folderRes . Result . Path , userInput + itemInfo ? . Extension ) , FilesystemItemType . File ) ,
354
- true ) ;
355
- } ) ;
356
- break ;
357
- }
342
+ case AddItemDialogItemType . File :
343
+ userInput = ! string . IsNullOrWhiteSpace ( userInput ) ? userInput : itemInfo ? . Name ?? "NewFile" . GetLocalized ( ) ;
344
+ created = await associatedInstance . FilesystemHelpers . CreateAsync (
345
+ StorageHelpers . FromPathAndType ( PathNormalization . Combine ( currentPath , userInput + itemInfo ? . Extension ) , FilesystemItemType . File ) ,
346
+ true ) ;
347
+ break ;
358
348
}
359
349
360
- if ( created == FileSystemStatusCode . Unauthorized )
350
+ if ( created . Status == ReturnResult . AccessUnauthorized )
361
351
{
362
352
await DialogDisplayHelper . ShowDialogAsync ( "AccessDenied" . GetLocalized ( ) , "AccessDeniedCreateDialog/Text" . GetLocalized ( ) ) ;
363
353
}
364
354
365
- return created . Result . Item2 ;
355
+ return created . Item ;
366
356
}
367
357
368
358
public static async Task CreateFolderWithSelectionAsync ( IShellPage associatedInstance )
369
359
{
370
360
try
371
361
{
372
- await CopyItem ( associatedInstance ) ;
362
+ var items = associatedInstance . SlimContentPage . SelectedItems . ToList ( ) . Select ( ( item ) => StorageHelpers . FromPathAndType (
363
+ item . ItemPath ,
364
+ item . PrimaryItemAttribute == StorageItemTypes . File ? FilesystemItemType . File : FilesystemItemType . Directory ) ) ;
373
365
var folder = await CreateFileFromDialogResultTypeForResult ( AddItemDialogItemType . Folder , null , associatedInstance ) ;
374
366
if ( folder == null )
375
367
{
376
368
return ;
377
369
}
378
- await associatedInstance . FilesystemHelpers . MoveItemsFromClipboard ( Clipboard . GetContent ( ) , folder . Path , false , true ) ;
370
+ await associatedInstance . FilesystemHelpers . MoveItemsAsync ( items , items . Select ( x => PathNormalization . Combine ( folder . Path , x . Name ) ) , false , true ) ;
379
371
}
380
372
catch ( Exception ex )
381
373
{
0 commit comments