aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 14:25:58 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 14:25:58 +0200
commit7d61c30b400b62069d1e69893ebe196412b2df2b (patch)
treee0a0655f153972f7db3efb5821d04926f020d489 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
parent0157053d3ab06d5fbf2777150bb12a9a35bd7368 (diff)
downloadTango-7d61c30b400b62069d1e69893ebe196412b2df2b.tar.gz
Tango-7d61c30b400b62069d1e69893ebe196412b2df2b.zip
Added PID Control.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs43
1 files changed, 41 insertions, 2 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 4becc0b04..0da894aba 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
@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core.Commands;
using Tango.Integration.Observables;
using Tango.SharedUI;
@@ -46,10 +47,20 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
set { _currentVersionDancerTypes = value; RaisePropertyChangedAuto(); }
}
+ private ObservableCollection<PidControl> _currentVersionPidControls;
+ public ObservableCollection<PidControl> CurrentVersionPidControls
+ {
+ get { return _currentVersionPidControls; }
+ set { _currentVersionPidControls = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand SaveCommand { get; set; }
public MainViewVM()
{
Adapter = ObservablesEntitiesAdapter.Instance;
+
+ SaveCommand = new RelayCommand(Save);
}
private void OnSelectedVersionChanged()
@@ -57,6 +68,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
CurrentVersion = SelectedVersion.Clone();
CurrentVersionDancerTypes = CurrentVersion.HardwareVersionsDancerTypes.Select(x => x.DancerType).ToObservableCollection();
CurrentVersionMotorTypes = CurrentVersion.HardwareVersionsMotorTypes.Select(x => x.MotorType).ToObservableCollection();
+ CurrentVersionPidControls = CurrentVersion.HardwareVersionsPidControls.Select(x => x.PidControl).ToObservableCollection();
}
public void OnRemoveDancer(DancerType dancerType)
@@ -69,14 +81,41 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
CurrentVersionMotorTypes.Remove(motorType);
}
+ public void OnRemovePidControl(PidControl pidControl)
+ {
+ CurrentVersionPidControls.Remove(pidControl);
+ }
+
public void OnMotorDrop(MotorType motorType)
{
- CurrentVersionMotorTypes.Add(motorType);
+ if (!CurrentVersionMotorTypes.Contains(motorType))
+ {
+ CurrentVersionMotorTypes.Add(motorType);
+ }
}
public void OnDropDancer(DancerType dancerType)
{
- CurrentVersionDancerTypes.Add(dancerType);
+ if (!CurrentVersionDancerTypes.Contains(dancerType))
+ {
+ CurrentVersionDancerTypes.Add(dancerType);
+ }
+ }
+
+ public void OnDropPidControl(PidControl pidControl)
+ {
+ if (!CurrentVersionPidControls.Contains(pidControl))
+ {
+ CurrentVersionPidControls.Add(pidControl);
+ }
+ }
+
+ private void Save()
+ {
+ if (CurrentVersion != null)
+ {
+
+ }
}
}
}