aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
commit9277bbd2fa070c69b83904f8fe5628fab2b947b8 (patch)
tree3099f9ce92f04c28517eb13938e913a1e376b3fe /Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels
parentf779e2b6f0bb1dedc7644c64651b59e31ce62c00 (diff)
downloadTango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.tar.gz
Tango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.zip
Working on job export import to storage.
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.cs35
1 files changed, 28 insertions, 7 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 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 <see cref="Storage.StorageModule"/>.
/// </summary>
/// <seealso cref="Tango.PPC.Common.PPCViewModel" />
- public class MainViewVM : PPCViewModel<IMainView>, INavigationResultProvider<ExplorerFileItem, String>
+ public class MainViewVM : PPCViewModel<IMainView>, INavigationResultProvider<ExplorerFileItem, StorageNavigationRequest>
{
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<ExplorerFileItem> FileSelectedCommand { get; set; }
+ public RelayCommand SaveCommand { get; set; }
+
public MainViewVM()
{
- CloseCommand = new RelayCommand(Close);
FileSelectedCommand = new RelayCommand<ExplorerFileItem>(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();
}
/// <summary>
@@ -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();
}
}
}