Example #1
0
        private async void PageExplorerPasteButtonClick(object sender, RoutedEventArgs e)
        {
            if (_isPasting == true)
            {
                return;
            }
            _isPasting = true;
            LoadingProgressBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
            if (CopiedCuttedItems.GetInstance().Items.Count > 0)
            {
                foreach (var item in CopiedCuttedItems.GetInstance().Items)
                {
                    if (item.Type == ExplorerItemType.File)
                    {
                        try
                        {
                            await item.StorageFile.CopyAsync(DataSource.CurrentStorageFolder, item.Name, NameCollisionOption.GenerateUniqueName);

                            if (CopiedCuttedItems.GetInstance().CutOrCopy == CopyCutState.Cut)
                            {
                                if (ExplorerItems.Contains(item))
                                {
                                    ExplorerItems.Remove(item);
                                }
                                await item.StorageFile.DeleteAsync(StorageDeleteOption.Default);
                            }
                        }
                        catch
                        { }
                    }
                }
                if (CopiedCuttedItems.GetInstance().CutOrCopy == CopyCutState.Cut)
                {
                    CopiedCuttedItems.GetInstance().Items.Clear();
                }
            }
            else if (DataSource.ShareStorageItems.Count > 0)
            {
                foreach (IStorageItem item in DataSource.ShareStorageItems)
                {
                    if (item is StorageFile)
                    {
                        try
                        {
                            StorageFile file = (StorageFile)item;
                            await file.CopyAsync(DataSource.CurrentStorageFolder, item.Name, NameCollisionOption.GenerateUniqueName);
                        }
                        catch
                        { }
                    }
                }
            }
            RefreshAfterAddNewItem();
            _isPasting = false;
        }
Example #2
0
 private void PageExplorerCutButtonClick(object sender, RoutedEventArgs e)
 {
     CopiedCuttedItems.GetInstance().Items.Clear();
     if (itemGridView.SelectedItems != null && itemGridView.SelectedItems.Count > 0)
     {
         foreach (var item in itemGridView.SelectedItems)
         {
             CopiedCuttedItems.GetInstance().Items.Add((item as ExplorerItem));
         }
         CopiedCuttedItems.GetInstance().CutOrCopy = CopyCutState.Cut;
     }
 }