diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-05-25 14:13:28 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-05-25 14:13:28 +0300 |
| commit | a7d1b350a7e6789942bd755f4a8dd48fb15a1a0a (patch) | |
| tree | 1e0b202b176a05d0921c91e67a43221479525d6c /Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels | |
| parent | 4571fffeccd4b037553fdeb0ddaff8005de67f23 (diff) | |
| download | Tango-a7d1b350a7e6789942bd755f4a8dd48fb15a1a0a.tar.gz Tango-a7d1b350a7e6789942bd755f4a8dd48fb15a1a0a.zip | |
Batch import/export jobs.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index 8c166379e..b9d59334c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -70,16 +71,21 @@ namespace Tango.PPC.Storage.ViewModels set { _displayItems = value; RaisePropertyChangedAuto(); } } - public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } + public ObservableCollection<ExplorerFileItem> SelectedItems { get; set; } + public RelayCommand SaveCommand { get; set; } + public RelayCommand OpenCommand { get; set; } + public MainViewVM() { + SelectedItems = new ObservableCollection<ExplorerFileItem>(); FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected); - SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName)); - Request = new StorageNavigationRequest(); + SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName) || Request.Intent == StorageNavigationIntent.SaveFiles); + Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles }; + OpenCommand = new RelayCommand(OnOpenCommand, () => Request.Intent == StorageNavigationIntent.LoadFiles); } public override void OnApplicationStarted() @@ -128,7 +134,7 @@ namespace Tango.PPC.Storage.ViewModels base.OnNavigatedFrom(); DisplayItems = false; Request = null; - Request = new StorageNavigationRequest(); + Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles }; } /// <summary> @@ -184,7 +190,14 @@ namespace Tango.PPC.Storage.ViewModels _selectedItem = fileItem; _allow_exit = true; await NavigationManager.NavigateBack(); - StorageProvider.SubmitFileSelection(fileItem); + StorageProvider.SubmitFileSelection(new List<ExplorerFileItem>() { fileItem }); + } + + private async void OnOpenCommand() + { + _allow_exit = true; + await NavigationManager.NavigateBack(); + StorageProvider.SubmitFileSelection(SelectedItems.ToList()); } public ExplorerFileItem GetNavigationResult() @@ -200,10 +213,22 @@ namespace Tango.PPC.Storage.ViewModels private void OnSaveCommand() { _allow_exit = true; - _selectedItem = new ExplorerFileItem() + + if (Request.Intent == StorageNavigationIntent.SaveFile) + { + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath + "\\" + FileName, + }; + } + else if (Request.Intent == StorageNavigationIntent.SaveFiles) { - Path = CurrentPath + "\\" + FileName, - }; + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath, + }; + } + NavigationManager.NavigateBack(); } |
