@@ -473,6 +473,10 @@ public async Task<ReturnResult> PerformOperationTypeAsync(DataPackageOperation o
473473 {
474474 return default ;
475475 }
476+ if ( destination . StartsWith ( App . AppSettings . RecycleBinPath ) )
477+ {
478+ return await RecycleItemsFromClipboard ( packageView , destination , showDialog , registerHistory ) ;
479+ }
476480 else if ( operation . HasFlag ( DataPackageOperation . Copy ) )
477481 {
478482 return await CopyItemsFromClipboard ( packageView , destination , showDialog , registerHistory ) ;
@@ -676,6 +680,36 @@ public async Task<ReturnResult> CopyItemAsync(IStorageItemWithPath source, strin
676680 return returnStatus ;
677681 }
678682
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+
679713 public async Task < ReturnResult > CopyItemsFromClipboard ( DataPackageView packageView , string destination , bool showDialog , bool registerHistory )
680714 {
681715 if ( packageView . Contains ( StandardDataFormats . StorageItems ) )
@@ -744,7 +778,6 @@ public async Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageVi
744778 }
745779
746780 // Happens if you copy some text and then you Ctrl+V in Files
747- // Should this be done in ModernShellPage?
748781 return ReturnResult . BadArgumentException ;
749782 }
750783
@@ -929,7 +962,6 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
929962 if ( ! packageView . Contains ( StandardDataFormats . StorageItems ) )
930963 {
931964 // Happens if you copy some text and then you Ctrl+V in Files
932- // Should this be done in ModernShellPage?
933965 return ReturnResult . BadArgumentException ;
934966 }
935967
@@ -940,15 +972,7 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
940972 }
941973 catch ( Exception ex ) when ( ( uint ) ex . HResult == 0x80040064 || ( uint ) ex . HResult == 0x8004006A )
942974 {
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
952976 return ReturnResult . Failed ;
953977 }
954978 catch ( Exception ex )
0 commit comments