aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-28 20:16:11 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-28 20:16:11 +0200
commitac3c227bb5d12339fee6fb4c243f3a5f67217915 (patch)
treebbafb0da5b25aeedda13b2ab89c4fbc36da45608 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels
parentc86a3bd32bf6d561fecf662b53b49749d2989b88 (diff)
downloadTango-ac3c227bb5d12339fee6fb4c243f3a5f67217915.tar.gz
Tango-ac3c227bb5d12339fee6fb4c243f3a5f67217915.zip
Working on machine studio storage !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs
index d7eec4d36..f28783590 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs
@@ -3,15 +3,94 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.Integration.ExternalBridge;
+using Tango.Integration.Storage;
using Tango.MachineStudio.Common;
+using Tango.MachineStudio.Common.StudioApplication;
namespace Tango.MachineStudio.Storage.ViewModels
{
public class MainViewVM : StudioViewModel
{
+ private IStudioApplicationManager _applicationManager;
+ private bool _machine_operator_changed = true;
+
+ private StorageManager _storageManager;
+ public StorageManager StorageManager
+ {
+ get { return _storageManager; }
+ set { _storageManager = value; RaisePropertyChangedAuto(); }
+ }
+
+ private StorageItem _selectedStorageItem;
+ public StorageItem SelectedStorageItem
+ {
+ get { return _selectedStorageItem; }
+ set { _selectedStorageItem = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _currentPath;
+ public String CurrentPath
+ {
+ get { return _currentPath; }
+ set { _currentPath = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand BackCommand { get; set; }
+
+ public RelayCommand RefreshCommand { get; set; }
+
+ public RelayCommand GoCommand { get; set; }
+
+ public MainViewVM(IStudioApplicationManager applicationManager)
+ {
+ _applicationManager = applicationManager;
+ _applicationManager.ConnectedMachineChanged += _applicationManager_ConnectedMachineChanged;
+
+ GoCommand = new RelayCommand(NavigateToCurrentPath);
+ }
+
+ private void _applicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient e)
+ {
+ _machine_operator_changed = true;
+
+ if (IsVisible)
+ {
+ Initialize();
+ }
+ }
+
public override void OnApplicationReady()
{
}
+
+ public override void OnNavigatedTo()
+ {
+ base.OnNavigatedTo();
+
+ if (_machine_operator_changed)
+ {
+ _machine_operator_changed = false;
+ Initialize();
+ }
+ }
+
+ private async void NavigateToCurrentPath()
+ {
+ await StorageManager.GetFolder(CurrentPath);
+ }
+
+ private async void Initialize()
+ {
+ if (_applicationManager.ConnectedMachine != null)
+ {
+ StorageManager = _applicationManager.ConnectedMachine.CreateStorageManager();
+ await StorageManager.GetStorageDrive();
+ await StorageManager.GetRootFolder();
+ CurrentPath = StorageManager.StorageDrive.Root;
+ }
+ }
}
}