aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-12-17 16:22:49 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-12-17 16:22:49 +0200
commit50433ea885a3ebdc6a55f733c9083b6e07c2cb3e (patch)
tree878e54f684fa24aae504b9dda006f4068bb86353 /Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs
parent39cf804612a97dfb848ac308a1b40bafc3780783 (diff)
parentf0f46e7e560cf5e9999e5ba9904634f01176f27e (diff)
downloadTango-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.Firmware/ViewModels/FileSystemViewVM.cs')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs53
1 files changed, 30 insertions, 23 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs
index 4c88d65be..e2be72127 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/FileSystemViewVM.cs
@@ -433,40 +433,47 @@ namespace Tango.FSE.Firmware.ViewModels
private async void UploadFiles(List<String> files)
{
- String currentPathBefore = CurrentPath;
-
- foreach (var file in files)
- {
- if (!File.Exists(file))
- {
- await NotificationProvider.ShowError($"File '{file}' cannot be uploaded.");
- return;
- }
- }
-
- foreach (var file in files)
+ try
{
- String itemName = Path.GetFileName(file);
+ String currentPathBefore = CurrentPath;
- if ((CurrentItem as IFileSystemContainer).Items.ToList().Exists(x => x.Name.ToLower() == itemName.ToLower()))
+ foreach (var file in files)
{
- if (!await NotificationProvider.ShowWarningQuestion($"'{itemName}' already exists on '{CurrentItem.Name}'. Do you want to overwrite?"))
+ if (!File.Exists(file))
{
- continue;
+ await NotificationProvider.ShowError($"File '{file}' cannot be uploaded.");
+ return;
}
}
- var handler = await FirmwareStorageProvider.Upload(file, Path.Combine(CurrentItem.Path, Path.GetFileName(file)));
-
- handler.StatusChanged += (x, status) =>
+ foreach (var file in files)
{
- if (status == FileSystemHandlerStatus.Completed && currentPathBefore == CurrentPath)
+ String itemName = Path.GetFileName(file);
+
+ 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 FirmwareStorageProvider.Upload(file, Path.Combine(CurrentItem.Path, Path.GetFileName(file)));
+
+ 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()}");
}
}