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 15:40:19 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 15:40:19 +0200
commit47c117490f9f9fed42329ebd1374709528693d6b (patch)
tree5c50f9acf1f9721d3db8cbecbdb5df89e6cc800e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
parent7d61c30b400b62069d1e69893ebe196412b2df2b (diff)
downloadTango-47c117490f9f9fed42329ebd1374709528693d6b.tar.gz
Tango-47c117490f9f9fed42329ebd1374709528693d6b.zip
Refactored Hardware Designer DAL.
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.cs54
1 files changed, 15 insertions, 39 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 0da894aba..06a3c9ba4 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
@@ -33,27 +33,6 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
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(); }
- }
-
- private ObservableCollection<PidControl> _currentVersionPidControls;
- public ObservableCollection<PidControl> CurrentVersionPidControls
- {
- get { return _currentVersionPidControls; }
- set { _currentVersionPidControls = value; RaisePropertyChangedAuto(); }
- }
-
public RelayCommand SaveCommand { get; set; }
public MainViewVM()
@@ -66,47 +45,44 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
private void OnSelectedVersionChanged()
{
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)
+ public void OnRemoveDancer(HardwareDancer dancer)
{
- CurrentVersionDancerTypes.Remove(dancerType);
+ CurrentVersion.HardwareDancers.Remove(dancer);
}
- public void OnRemoveMotor(MotorType motorType)
+ public void OnRemoveMotor(HardwareMotor motor)
{
- CurrentVersionMotorTypes.Remove(motorType);
+ CurrentVersion.HardwareMotors.Remove(motor);
}
- public void OnRemovePidControl(PidControl pidControl)
+ public void OnRemovePidControl(HardwarePidControl pidControl)
{
- CurrentVersionPidControls.Remove(pidControl);
+ CurrentVersion.HardwarePidControls.Remove(pidControl);
}
- public void OnMotorDrop(MotorType motorType)
+ public void OnMotorDrop(HardwareMotorType motorType)
{
- if (!CurrentVersionMotorTypes.Contains(motorType))
+ if (!CurrentVersion.HardwareMotors.ToList().Exists(x => x.HardwareMotorType == motorType))
{
- CurrentVersionMotorTypes.Add(motorType);
+ CurrentVersion.HardwareMotors.Add(new HardwareMotor() { HardwareMotorType = motorType });
}
}
- public void OnDropDancer(DancerType dancerType)
+ public void OnDropDancer(HardwareDancerType dancerType)
{
- if (!CurrentVersionDancerTypes.Contains(dancerType))
+ if (!CurrentVersion.HardwareDancers.ToList().Exists(x => x.HardwareDancerType == dancerType))
{
- CurrentVersionDancerTypes.Add(dancerType);
+ CurrentVersion.HardwareDancers.Add(new HardwareDancer() { HardwareDancerType = dancerType });
}
}
- public void OnDropPidControl(PidControl pidControl)
+ public void OnDropPidControl(HardwarePidControlType pidControlType)
{
- if (!CurrentVersionPidControls.Contains(pidControl))
+ if (!CurrentVersion.HardwarePidControls.ToList().Exists(x => x.HardwarePidControlType == pidControlType))
{
- CurrentVersionPidControls.Add(pidControl);
+ CurrentVersion.HardwarePidControls.Add(new HardwarePidControl() { HardwarePidControlType = pidControlType });
}
}