diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-15 04:54:52 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-15 04:54:52 +0300 |
| commit | 52813618e140c921ff653d9c227c35032207b495 (patch) | |
| tree | 5eef9e6cf26475b5ba31e9359bfd2c38531debae /Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs | |
| parent | 7100354b0059cddfcffa4931216f4b8087bd94b1 (diff) | |
| download | Tango-52813618e140c921ff653d9c227c35032207b495.tar.gz Tango-52813618e140c921ff653d9c227c35032207b495.zip | |
FSE Firmware FileSystem.
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 | 59 |
1 files changed, 40 insertions, 19 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 4ed6629b5..b34c8c527 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 @@ -387,13 +387,23 @@ namespace Tango.FSE.PPCConsole.ViewModels } } - private async void RetryFailedFileSystemHandler(FileSystemHandler handler) + private void RetryFailedFileSystemHandler(FileSystemHandler handler) { - if (handler.Status == FileSystemHandlerStatus.Failed) - { - var newHandler = await FileSystemProvider.Download(handler.FileSystemItem, Path.GetDirectoryName(handler.Destination)); - FileSystemHandlers.Replace(handler, newHandler); - } + //Not supported Yet! + + //if (handler.Status == FileSystemHandlerStatus.Failed) + //{ + // if (handler.Type == FileSystemHandlerType.FileDownload || handler.Type == FileSystemHandlerType.FolderDownload) + // { + // var newHandler = await FileSystemProvider.Download(handler.FileSystemItem, Path.GetDirectoryName(handler.Destination)); + // FileSystemHandlers.Replace(handler, newHandler); + // } + // else + // { + // var newHandler = await FileSystemProvider.Upload(Path.GetDirectoryName(handler.Destination), handler.FileSystemItem); + // FileSystemHandlers.Replace(handler, newHandler); + // } + //} } private async void NavigateToSpecialFolder(string folder) @@ -502,26 +512,37 @@ namespace Tango.FSE.PPCConsole.ViewModels private async void DownloadSelectedItems(List<FileSystemItem> items) { - var result = await StorageProvider.SelectFolder("Select download destination folder"); - if (result) + if (items.Count == 1 && items.First().Type == FileSystemItemType.File) { + var fileItem = items.First() as FileItem; - String destination = result.SelectedItem; - - Debug.WriteLine($"Download to {result.SelectedItem}"); - - foreach (var item in items.Where(x => x.Type != FileSystemItemType.Drive)) + var result = await StorageProvider.SaveFile("Select download destination file", $"{fileItem.Description}|*{fileItem.Extension}", fileItem.Name, fileItem.Extension); + if (result) { - if (File.Exists(Path.Combine(destination, item.Name)) || Directory.Exists(Path.Combine(destination, item.Name))) + var handler = await FileSystemProvider.Download(fileItem, result.SelectedItem, true); + FileSystemHandlers.Insert(0, handler); + } + } + else + { + var result = await StorageProvider.SelectFolder("Select download destination folder"); + if (result) + { + String destination = result.SelectedItem; + + foreach (var item in items.Where(x => x.Type != FileSystemItemType.Drive)) { - if (!await NotificationProvider.ShowWarningQuestion($"'{item.Name}' already exists on '{Path.GetDirectoryName(destination)}'. Do you want to overwrite?")) + if (File.Exists(Path.Combine(destination, item.Name)) || Directory.Exists(Path.Combine(destination, item.Name))) { - continue; + 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); + var handler = await FileSystemProvider.Download(item, destination); + FileSystemHandlers.Insert(0, handler); + } } } } |
