aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
index 4e2ca1882..e10cc0ad1 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
@@ -58,6 +58,7 @@ namespace Tango.FSE.PPCConsole.ViewModels
public RelayCommand<List<FileSystemItem>> CutPasteCommand { get; set; }
public RelayCommand<List<FileSystemItem>> DownloadCommand { get; set; }
public RelayCommand<FileSystemItem> RenameCommand { get; set; }
+ public RelayCommand NewFolderCommand { get; set; }
public FileSystemViewVM()
@@ -78,6 +79,7 @@ namespace Tango.FSE.PPCConsole.ViewModels
CutPasteCommand = new RelayCommand<List<FileSystemItem>>((items) => PasteItems(items, true));
DownloadCommand = new RelayCommand<List<FileSystemItem>>(DownloadSelectedItems);
RenameCommand = new RelayCommand<FileSystemItem>(RenameFileSystemItem);
+ NewFolderCommand = new RelayCommand(CreateNewFolder);
}
private async void NavigateBack()
@@ -341,7 +343,24 @@ namespace Tango.FSE.PPCConsole.ViewModels
var result = await StorageProvider.SelectFolder("Select download destination folder");
if (result)
{
+
+ String destination = result.SelectedItem;
+
Debug.WriteLine($"Download to {result.SelectedItem}");
+
+ foreach (var item in items.Where(x => x.Type != FileSystemItemType.Drive))
+ {
+ if (File.Exists(Path.Combine(destination, item.Name)) || Directory.Exists(Path.Combine(destination, item.Name)))
+ {
+ if (!await NotificationProvider.ShowWarningQuestion($"'{item.Name}' already exists on '{Path.GetDirectoryName(destination)}'. Do you want to overwrite?"))
+ {
+ continue;
+ }
+ }
+
+ var handler = await FileSystemProvider.Download(item, destination);
+ FileSystemHandlers.Insert(0, handler);
+ }
}
}
@@ -376,6 +395,40 @@ namespace Tango.FSE.PPCConsole.ViewModels
}
}
+ private async void CreateNewFolder()
+ {
+ if (CurrentItem == null) return;
+ if (CurrentItem is FolderItem)
+ {
+ if ((CurrentItem as FolderItem).IsRoot) return;
+ }
+
+ var result = await NotificationProvider.ShowInputBox(
+ "New Folder",
+ $"Please enter a folder name and press 'ENTER'.",
+ PackIconKind.FolderAdd, "untitled",
+ "folder name",
+ 100,
+ "CREATE");
+
+ if (result.Confirmed)
+ {
+ try
+ {
+ using (NotificationProvider.PushTaskItem("Creating new folder..."))
+ {
+ var folderItem = await FileSystemProvider.CreateFolder(CurrentItem, result.Input);
+ NavigateToCurrentPath(); //Instead of inserting folder item just refresh the current path...
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error creating new folder '{Path.Combine(CurrentItem.Path,result.Input)}.");
+ await NotificationProvider.ShowError($"Error creating folder '{result.Input}'.\n{ex.FlattenMessage()}");
+ }
+ }
+ }
+
private void OnCurrentItemChanged()
{
CurrentPath = CurrentItem.Path;