diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-17 16:22:49 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-17 16:22:49 +0200 |
| commit | 50433ea885a3ebdc6a55f733c9083b6e07c2cb3e (patch) | |
| tree | 878e54f684fa24aae504b9dda006f4068bb86353 /Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs | |
| parent | 39cf804612a97dfb848ac308a1b40bafc3780783 (diff) | |
| parent | f0f46e7e560cf5e9999e5ba9904634f01176f27e (diff) | |
| download | Tango-50433ea885a3ebdc6a55f733c9083b6e07c2cb3e.tar.gz Tango-50433ea885a3ebdc6a55f733c9083b6e07c2cb3e.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()}"); } } } |
