diff options
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 | 69 |
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); + } } } |
