From 9277bbd2fa070c69b83904f8fe5628fab2b947b8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 25 Nov 2018 17:52:49 +0200 Subject: Working on job export import to storage. --- .../Tango.PPC.Storage/ViewModels/MainViewVM.cs | 35 +++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels') 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 e62ebc932..05316d1f6 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 @@ -7,6 +7,7 @@ using Tango.Core.Commands; using Tango.Explorer; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; +using Tango.PPC.Storage.Models; using Tango.PPC.Storage.TaskBarItems; using Tango.PPC.Storage.ViewContracts; @@ -16,7 +17,7 @@ namespace Tango.PPC.Storage.ViewModels /// Represents the main view VM and entry point for . /// /// - public class MainViewVM : PPCViewModel, INavigationResultProvider + public class MainViewVM : PPCViewModel, INavigationResultProvider { private bool _allow_exit; private ExplorerFileItem _selectedItem; @@ -28,14 +29,22 @@ namespace Tango.PPC.Storage.ViewModels set { _currentPath = value; RaisePropertyChangedAuto(); } } - public RelayCommand CloseCommand { get; set; } + private StorageNavigationRequest _request; + public StorageNavigationRequest Request + { + get { return _request; } + set { _request = value; RaisePropertyChangedAuto(); } + } public RelayCommand FileSelectedCommand { get; set; } + public RelayCommand SaveCommand { get; set; } + public MainViewVM() { - CloseCommand = new RelayCommand(Close); FileSelectedCommand = new RelayCommand(OnFileSelected); + SaveCommand = new RelayCommand(OnSaveCommand); + Request = new StorageNavigationRequest(); } public override void OnApplicationStarted() @@ -61,6 +70,7 @@ namespace Tango.PPC.Storage.ViewModels if (StorageProvider.IsConnected && StorageProvider.Drive != null) { + CurrentPath = null; CurrentPath = StorageProvider.Drive.RootDirectory.FullName; } else @@ -71,9 +81,10 @@ namespace Tango.PPC.Storage.ViewModels } } - private async void Close() + public override void OnNavigatedFrom() { - await NavigationManager.NavigateBack(); + base.OnNavigatedFrom(); + Request = new StorageNavigationRequest(); } /// @@ -114,6 +125,7 @@ namespace Tango.PPC.Storage.ViewModels { if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName) { + Request = null; return Task.FromResult(true); } else @@ -127,7 +139,7 @@ namespace Tango.PPC.Storage.ViewModels { _allow_exit = true; await NavigationManager.NavigateBack(); - await NotificationProvider.ShowInfo($"File Selected: {fileItem.Name}"); + StorageProvider.SubmitFileSelection(fileItem); } public ExplorerFileItem GetNavigationResult() @@ -135,9 +147,18 @@ namespace Tango.PPC.Storage.ViewModels return _selectedItem; } - public void OnNavigationObjectReceived(string extension) + public void OnNavigationObjectReceived(StorageNavigationRequest request) { + Request = request; + } + private void OnSaveCommand() + { + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath + "\\" + Request.DefaultFileName, + }; + NavigationManager.NavigateBack(); } } } -- cgit v1.3.1