diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-01 12:01:46 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-01 12:01:46 +0200 |
| commit | 93e915dd3fc06ae20b29aa927966676b9f8b7c5a (patch) | |
| tree | f5c5d5e47513e474c68f295c6abd18f3d18a9c6b /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels | |
| parent | 9823b433c62ed173671923c32ccccadc1d06c0bd (diff) | |
| download | Tango-93e915dd3fc06ae20b29aa927966676b9f8b7c5a.tar.gz Tango-93e915dd3fc06ae20b29aa927966676b9f8b7c5a.zip | |
Lots of work !
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.cs | 45 |
1 files changed, 45 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 6d605ed1c..8fede46fe 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 @@ -37,6 +37,19 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels set { _currentVersion = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private IObservableEntity _selectedHardwareObject; + public IObservableEntity SelectedHardwareObject + { + get { return _selectedHardwareObject; } + set + { + _selectedHardwareObject = null; + RaisePropertyChangedAuto(); + _selectedHardwareObject = value; + RaisePropertyChangedAuto(); + } + } + public RelayCommand SaveCommand { get; set; } public RelayCommand DeleteCommand { get; set; } @@ -79,8 +92,15 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels CurrentVersion.HardwarePidControls.Remove(pidControl); } + public void OnRemoveWinder(HardwareWinder hardwareWinder) + { + CurrentVersion.HardwareWinders.Remove(hardwareWinder); + } + public void OnMotorDrop(HardwareMotorType motorType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwareMotors.ToList().Exists(x => x.HardwareMotorType == motorType)) { CurrentVersion.HardwareMotors.Add(new HardwareMotor() { HardwareMotorType = motorType }); @@ -89,6 +109,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public void OnDropDancer(HardwareDancerType dancerType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwareDancers.ToList().Exists(x => x.HardwareDancerType == dancerType)) { CurrentVersion.HardwareDancers.Add(new HardwareDancer() { HardwareDancerType = dancerType }); @@ -97,12 +119,35 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public void OnDropPidControl(HardwarePidControlType pidControlType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwarePidControls.ToList().Exists(x => x.HardwarePidControlType == pidControlType)) { CurrentVersion.HardwarePidControls.Add(new HardwarePidControl() { HardwarePidControlType = pidControlType }); } } + public void OnDropWinder(HardwareWinderType hardwareWinderType) + { + if (CheckCurrentVersionNull()) return; + + if (!CurrentVersion.HardwareWinders.ToList().Exists(x => x.HardwareWinderType == hardwareWinderType)) + { + CurrentVersion.HardwareWinders.Add(new HardwareWinder() { HardwareWinderType = hardwareWinderType }); + } + } + + private bool CheckCurrentVersionNull() + { + if (CurrentVersion == null) + { + _notification.ShowInfo("Please select a hardware version before attempting to insert any components."); + return true; + } + + return false; + } + private void New() { String name = _notification.ShowTextInput("Enter hardware version name", "Name"); |
