From 78395f3cc37b263640ad4d0228b9172ebe0ac0e3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 16 May 2018 14:35:04 +0300 Subject: Implemented new Hardware Speed Sensor ! --- .../ViewModels/MachineTechViewVM.cs | 45 ++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 9c587b7c8..ac78ef488 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -521,6 +521,10 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(bounds, Adapter.HardwareDancerTypes.FirstOrDefault()); } + else if (item is SpeedSensorItem) + { + CreateElement(bounds, Adapter.HardwareSpeedSensorTypes.FirstOrDefault()); + } } /// @@ -635,6 +639,11 @@ namespace Tango.MachineStudio.Technician.ViewModels (item as DancerItem).HardwareDancerType = Adapter.HardwareDancerTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); CreateElement(item); } + else if (item is SpeedSensorItem) + { + (item as SpeedSensorItem).HardwareSpeedSensorType = Adapter.HardwareSpeedSensorTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement(item); + } } /// @@ -1327,6 +1336,16 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + foreach (var speedSensorConfig in config.SpeedSensors) + { + var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.ToInt32()); + + if (itemConfig != null) + { + speedSensorConfig.MapPrimitivesTo(itemConfig); + } + } + _notification.ShowInfo("Visual elements synced to the last uploaded hardware configuration."); } else @@ -1371,13 +1390,23 @@ namespace Tango.MachineStudio.Technician.ViewModels } } - foreach (var DancerConfig in hw.HardwareDancers) + foreach (var dancerConfig in hw.HardwareDancers) { - var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == DancerConfig.HardwareDancerType.Code); + var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code); if (itemConfig != null) { - itemConfig.MapPrimitivesTo(DancerConfig); + itemConfig.MapPrimitivesTo(dancerConfig); + } + } + + foreach (var speedSensorConfig in hw.HardwareSpeedSensors) + { + var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(speedSensorConfig); } } @@ -1442,6 +1471,16 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + foreach (var speedSensorConfig in hw.HardwareSpeedSensors) + { + var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code); + + if (itemConfig != null) + { + speedSensorConfig.MapPrimitivesTo(itemConfig); + } + } + _notification.ShowInfo("Visual elements synced to hardware version " + hw.Name + ", " + hw.Version + "."); } } -- cgit v1.3.1