diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-27 15:40:19 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-27 15:40:19 +0200 |
| commit | 47c117490f9f9fed42329ebd1374709528693d6b (patch) | |
| tree | 5c50f9acf1f9721d3db8cbecbdb5df89e6cc800e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs | |
| parent | 7d61c30b400b62069d1e69893ebe196412b2df2b (diff) | |
| download | Tango-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.cs | 54 |
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 }); } } |
