diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-12-17 14:39:26 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-12-17 14:39:26 +0200 |
| commit | f0f46e7e560cf5e9999e5ba9904634f01176f27e (patch) | |
| tree | 961affaea885d7306faca197a72c20f4811d7b8c /Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs | |
| parent | a84ca31290b18ef2a9ec4c197d86573bb13adb03 (diff) | |
| parent | d9ee0b8e11f15c2b3bae068767516bc84a5ca4ed (diff) | |
| download | Tango-f0f46e7e560cf5e9999e5ba9904634f01176f27e.tar.gz Tango-f0f46e7e560cf5e9999e5ba9904634f01176f27e.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
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.cs | 92 |
1 files changed, 53 insertions, 39 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 b34c8c527..2ab3e5c62 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 @@ -326,31 +326,38 @@ namespace Tango.FSE.PPCConsole.ViewModels private async void OnItemsDroppedIn(List<FileSystemItem> items) { - String currentPathBefore = CurrentPath; - - foreach (var item in items.Where(x => x.Type != FileSystemItemType.Drive)) + try { - Debug.WriteLine($"Dropped in: {item.Name} => {CurrentItem.Path}"); + String currentPathBefore = CurrentPath; - if ((CurrentItem as IFileSystemContainer).Items.ToList().Exists(x => x.Name.ToLower() == item.Name.ToLower())) + foreach (var item in items.Where(x => x.Type != FileSystemItemType.Drive)) { - if (!await NotificationProvider.ShowWarningQuestion($"'{item.Name}' already exists on '{CurrentItem.Name}'. Do you want to overwrite?")) + Debug.WriteLine($"Dropped in: {item.Name} => {CurrentItem.Path}"); + + if ((CurrentItem as IFileSystemContainer).Items.ToList().Exists(x => x.Name.ToLower() == item.Name.ToLower())) { - continue; + if (!await NotificationProvider.ShowWarningQuestion($"'{item.Name}' already exists on '{CurrentItem.Name}'. Do you want to overwrite?")) + { + continue; + } } - } - var handler = await FileSystemProvider.Upload(item.Path, CurrentItem); + var handler = await FileSystemProvider.Upload(item.Path, CurrentItem); - handler.StatusChanged += (x, status) => - { - if (status == FileSystemHandlerStatus.Completed && currentPathBefore == CurrentPath) + handler.StatusChanged += (x, status) => { - NavigateToCurrentPath(); - } - }; + if (status == FileSystemHandlerStatus.Completed && currentPathBefore == CurrentPath) + { + NavigateToCurrentPath(); + } + }; - FileSystemHandlers.Insert(0, handler); + FileSystemHandlers.Insert(0, handler); + } + } + catch (Exception ex) + { + await NotificationProvider.ShowError($"Error uploading to file system.\n{ex.FlattenMessage()}"); } } @@ -552,40 +559,47 @@ namespace Tango.FSE.PPCConsole.ViewModels var result = await StorageProvider.SelectFilesAndFolders("Select files and folders to upload"); if (result) { - String currentPathBefore = CurrentPath; - - foreach (var item in result.SelectedItems) - { - if (!File.Exists(item) && !Directory.Exists(item)) - { - await NotificationProvider.ShowError($"File or folder '{item}' cannot be uploaded."); - return; - } - } - - foreach (var item in result.SelectedItems) + try { - String itemName = Path.GetFileName(item); + String currentPathBefore = CurrentPath; - if ((CurrentItem as IFileSystemContainer).Items.ToList().Exists(x => x.Name.ToLower() == itemName.ToLower())) + foreach (var item in result.SelectedItems) { - if (!await NotificationProvider.ShowWarningQuestion($"'{itemName}' already exists on '{CurrentItem.Name}'. Do you want to overwrite?")) + if (!File.Exists(item) && !Directory.Exists(item)) { - continue; + await NotificationProvider.ShowError($"File or folder '{item}' cannot be uploaded."); + return; } } - var handler = await FileSystemProvider.Upload(item, CurrentItem); - - handler.StatusChanged += (x, status) => + foreach (var item in result.SelectedItems) { - if (status == FileSystemHandlerStatus.Completed && currentPathBefore == CurrentPath) + String itemName = Path.GetFileName(item); + + if ((CurrentItem as IFileSystemContainer).Items.ToList().Exists(x => x.Name.ToLower() == itemName.ToLower())) { - NavigateToCurrentPath(); + if (!await NotificationProvider.ShowWarningQuestion($"'{itemName}' already exists on '{CurrentItem.Name}'. Do you want to overwrite?")) + { + continue; + } } - }; - FileSystemHandlers.Insert(0, handler); + var handler = await FileSystemProvider.Upload(item, CurrentItem); + + handler.StatusChanged += (x, status) => + { + if (status == FileSystemHandlerStatus.Completed && currentPathBefore == CurrentPath) + { + NavigateToCurrentPath(); + } + }; + + FileSystemHandlers.Insert(0, handler); + } + } + catch (Exception ex) + { + await NotificationProvider.ShowError($"Error uploading to file system.\n{ex.FlattenMessage()}"); } } } |
