@@ -473,6 +473,10 @@ public async Task<ReturnResult> PerformOperationTypeAsync(DataPackageOperation o
473
473
{
474
474
return default ;
475
475
}
476
+ if ( destination . StartsWith ( App . AppSettings . RecycleBinPath ) )
477
+ {
478
+ return await RecycleItemsFromClipboard ( packageView , destination , showDialog , registerHistory ) ;
479
+ }
476
480
else if ( operation . HasFlag ( DataPackageOperation . Copy ) )
477
481
{
478
482
return await CopyItemsFromClipboard ( packageView , destination , showDialog , registerHistory ) ;
@@ -676,6 +680,36 @@ public async Task<ReturnResult> CopyItemAsync(IStorageItemWithPath source, strin
676
680
return returnStatus ;
677
681
}
678
682
683
+ public async Task < ReturnResult > RecycleItemsFromClipboard ( DataPackageView packageView , string destination , bool showDialog , bool registerHistory )
684
+ {
685
+ if ( ! packageView . Contains ( StandardDataFormats . StorageItems ) )
686
+ {
687
+ // Happens if you copy some text and then you Ctrl+V in Files
688
+ return ReturnResult . BadArgumentException ;
689
+ }
690
+
691
+ IReadOnlyList < IStorageItem > source ;
692
+ try
693
+ {
694
+ source = await packageView . GetStorageItemsAsync ( ) ;
695
+ }
696
+ catch ( Exception ex ) when ( ( uint ) ex . HResult == 0x80040064 || ( uint ) ex . HResult == 0x8004006A )
697
+ {
698
+ // Not supported
699
+ return ReturnResult . Failed ;
700
+ }
701
+ catch ( Exception ex )
702
+ {
703
+ App . Logger . Warn ( ex , ex . Message ) ;
704
+ return ReturnResult . UnknownException ;
705
+ }
706
+ ReturnResult returnStatus = ReturnResult . InProgress ;
707
+
708
+ returnStatus = await DeleteItemsAsync ( source , showDialog , false , registerHistory ) ;
709
+
710
+ return returnStatus ;
711
+ }
712
+
679
713
public async Task < ReturnResult > CopyItemsFromClipboard ( DataPackageView packageView , string destination , bool showDialog , bool registerHistory )
680
714
{
681
715
if ( packageView . Contains ( StandardDataFormats . StorageItems ) )
@@ -744,7 +778,6 @@ public async Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageVi
744
778
}
745
779
746
780
// Happens if you copy some text and then you Ctrl+V in Files
747
- // Should this be done in ModernShellPage?
748
781
return ReturnResult . BadArgumentException ;
749
782
}
750
783
@@ -929,7 +962,6 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
929
962
if ( ! packageView . Contains ( StandardDataFormats . StorageItems ) )
930
963
{
931
964
// Happens if you copy some text and then you Ctrl+V in Files
932
- // Should this be done in ModernShellPage?
933
965
return ReturnResult . BadArgumentException ;
934
966
}
935
967
@@ -940,15 +972,7 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
940
972
}
941
973
catch ( Exception ex ) when ( ( uint ) ex . HResult == 0x80040064 || ( uint ) ex . HResult == 0x8004006A )
942
974
{
943
- if ( associatedInstance . ServiceConnection != null )
944
- {
945
- var ( status , response ) = await associatedInstance . ServiceConnection . SendMessageForResponseAsync ( new ValueSet ( ) {
946
- { "Arguments" , "FileOperation" } ,
947
- { "fileop" , "DragDrop" } ,
948
- { "droptext" , "DragDropWindowText" . GetLocalized ( ) } ,
949
- { "droppath" , associatedInstance . FilesystemViewModel . WorkingDirectory } } ) ;
950
- return ( status == AppServiceResponseStatus . Success && response . Get ( "Success" , false ) ) ? ReturnResult . Success : ReturnResult . Failed ;
951
- }
975
+ // Not supported
952
976
return ReturnResult . Failed ;
953
977
}
954
978
catch ( Exception ex )
0 commit comments