@@ -498,6 +498,11 @@ public static async void DeleteItem_Click(object sender, RoutedEventArgs e)
498
498
//NavigationActions.Refresh_Click(null, null);
499
499
History . ForwardList . Clear ( ) ;
500
500
ItemViewModel . FS . isEnabled = false ;
501
+ // TODO: FIX SELECTION LOST (maybe?) ON ITEM REMOVAL
502
+ if ( GenericFileBrowser . data . SelectedItems . Count > 0 )
503
+ {
504
+ DeleteItem_Click ( null , null ) ;
505
+ }
501
506
}
502
507
else if ( page . Name == "PhotoAlbumViewer" )
503
508
{
@@ -571,9 +576,40 @@ public static async void RenameItem_Click(object sender, RoutedEventArgs e)
571
576
ItemViewModel . FS . isEnabled = false ;
572
577
}
573
578
574
- public static void CutItem_Click ( object sender , RoutedEventArgs e )
579
+ static List < string > pathsToDeleteAfterPaste = new List < string > ( ) ;
580
+
581
+ public async static void CutItem_Click ( object sender , RoutedEventArgs e )
575
582
{
583
+ DataPackage dataPackage = new DataPackage ( ) ;
584
+ dataPackage . RequestedOperation = DataPackageOperation . Move ;
585
+ pathsToDeleteAfterPaste . Clear ( ) ;
586
+ if ( page . Name == "GenericItemView" )
587
+ {
588
+ if ( GenericFileBrowser . data . SelectedItems . Count != 0 )
589
+ {
590
+ List < IStorageItem > items = new List < IStorageItem > ( ) ;
591
+ foreach ( ListedItem StorItem in GenericFileBrowser . data . SelectedItems )
592
+ {
593
+ pathsToDeleteAfterPaste . Add ( StorItem . FilePath ) ;
594
+ if ( StorItem . FileExtension != "Folder" )
595
+ {
596
+ var item = await StorageFile . GetFileFromPathAsync ( StorItem . FilePath ) ;
597
+ items . Add ( item ) ;
598
+ }
599
+ else
600
+ {
601
+ var item = await StorageFolder . GetFolderFromPathAsync ( StorItem . FilePath ) ;
602
+ items . Add ( item ) ;
603
+ }
604
+ }
605
+
606
+ IEnumerable < IStorageItem > EnumerableOfItems = items ;
607
+ dataPackage . SetStorageItems ( EnumerableOfItems ) ;
608
+ Clipboard . SetContent ( dataPackage ) ;
609
+
576
610
611
+ }
612
+ }
577
613
}
578
614
579
615
public static async void CopyItem_ClickAsync ( object sender , RoutedEventArgs e )
@@ -638,6 +674,7 @@ public static async void PasteItem_ClickAsync(object sender, RoutedEventArgs e)
638
674
// TODO: Add progress box and collision options for this operation
639
675
var DestinationPath = ItemViewModel . PUIP . Path ;
640
676
DataPackageView packageView = Clipboard . GetContent ( ) ;
677
+
641
678
var ItemsToPaste = await packageView . GetStorageItemsAsync ( ) ;
642
679
foreach ( IStorageItem item in ItemsToPaste )
643
680
{
@@ -652,6 +689,22 @@ public static async void PasteItem_ClickAsync(object sender, RoutedEventArgs e)
652
689
}
653
690
}
654
691
NavigationActions . Refresh_Click ( null , null ) ;
692
+ if ( packageView . RequestedOperation == DataPackageOperation . Move )
693
+ {
694
+ foreach ( string path in pathsToDeleteAfterPaste )
695
+ {
696
+ if ( path . Contains ( "." ) )
697
+ {
698
+ StorageFile file = await StorageFile . GetFileFromPathAsync ( path ) ;
699
+ await file . DeleteAsync ( ) ;
700
+ }
701
+ if ( ! path . Contains ( "." ) )
702
+ {
703
+ StorageFolder folder = await StorageFolder . GetFolderFromPathAsync ( path ) ;
704
+ await folder . DeleteAsync ( ) ;
705
+ }
706
+ }
707
+ }
655
708
}
656
709
657
710
public static async void CloneDirectoryAsync ( string SourcePath , string DestinationPath , string sourceRootName )
0 commit comments