aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-26 20:32:55 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-26 20:32:55 +0200
commit718a583833613a378ac2f4e4a5927ba5b48677ce (patch)
tree70a4c13a0d4821ffafefac226e779a2eb03aa84c /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels
parent5dc0936b6d8cb9bd4c334be0b0ad8dc1f3f84273 (diff)
downloadTango-718a583833613a378ac2f4e4a5927ba5b48677ce.tar.gz
Tango-718a583833613a378ac2f4e4a5927ba5b48677ce.zip
Working on hardware designer...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs69
1 files changed, 69 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
index 9fd24d165..4becc0b04 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
@@ -1,13 +1,82 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Integration.Observables;
using Tango.SharedUI;
namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
public class MainViewVM : ViewModel
{
+ private ObservablesEntitiesAdapter _adapter;
+ public ObservablesEntitiesAdapter Adapter
+ {
+ get { return _adapter; }
+ set { _adapter = value; RaisePropertyChangedAuto(); }
+ }
+
+ private HardwareVersion _selectedVersion;
+ public HardwareVersion SelectedVersion
+ {
+ get { return _selectedVersion; }
+ set { _selectedVersion = value; RaisePropertyChangedAuto(); OnSelectedVersionChanged(); }
+ }
+
+ private HardwareVersion _currentVersion;
+ public HardwareVersion CurrentVersion
+ {
+ get { return _currentVersion; }
+ set { _currentVersion = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ObservableCollection<MotorType> _currentVersionMotorTypes;
+ public ObservableCollection<MotorType> CurrentVersionMotorTypes
+ {
+ get { return _currentVersionMotorTypes; }
+ set { _currentVersionMotorTypes = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ObservableCollection<DancerType> _currentVersionDancerTypes;
+ public ObservableCollection<DancerType> CurrentVersionDancerTypes
+ {
+ get { return _currentVersionDancerTypes; }
+ set { _currentVersionDancerTypes = value; RaisePropertyChangedAuto(); }
+ }
+
+
+ public MainViewVM()
+ {
+ Adapter = ObservablesEntitiesAdapter.Instance;
+ }
+
+ private void OnSelectedVersionChanged()
+ {
+ CurrentVersion = SelectedVersion.Clone();
+ CurrentVersionDancerTypes = CurrentVersion.HardwareVersionsDancerTypes.Select(x => x.DancerType).ToObservableCollection();
+ CurrentVersionMotorTypes = CurrentVersion.HardwareVersionsMotorTypes.Select(x => x.MotorType).ToObservableCollection();
+ }
+
+ public void OnRemoveDancer(DancerType dancerType)
+ {
+ CurrentVersionDancerTypes.Remove(dancerType);
+ }
+
+ public void OnRemoveMotor(MotorType motorType)
+ {
+ CurrentVersionMotorTypes.Remove(motorType);
+ }
+
+ public void OnMotorDrop(MotorType motorType)
+ {
+ CurrentVersionMotorTypes.Add(motorType);
+ }
+
+ public void OnDropDancer(DancerType dancerType)
+ {
+ CurrentVersionDancerTypes.Add(dancerType);
+ }
}
}