aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-05-16 14:35:04 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-05-16 14:35:04 +0300
commit78395f3cc37b263640ad4d0228b9172ebe0ac0e3 (patch)
treecf7fc569308b1df2236560ef99ac6e3c808bbd1f /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels
parent5dba4e859e2806ce74d806fbd5dda37b7fa628d5 (diff)
downloadTango-78395f3cc37b263640ad4d0228b9172ebe0ac0e3.tar.gz
Tango-78395f3cc37b263640ad4d0228b9172ebe0ac0e3.zip
Implemented new Hardware Speed Sensor !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs45
1 files changed, 42 insertions, 3 deletions
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<DancerElementEditor, DancerItem, HardwareDancerType>(bounds, Adapter.HardwareDancerTypes.FirstOrDefault());
}
+ else if (item is SpeedSensorItem)
+ {
+ CreateElement<SpeedSensorElementEditor, SpeedSensorItem, HardwareSpeedSensorType>(bounds, Adapter.HardwareSpeedSensorTypes.FirstOrDefault());
+ }
}
/// <summary>
@@ -635,6 +639,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
(item as DancerItem).HardwareDancerType = Adapter.HardwareDancerTypes.FirstOrDefault(x => x.Guid == item.ItemGuid);
CreateElement<DancerElementEditor>(item);
}
+ else if (item is SpeedSensorItem)
+ {
+ (item as SpeedSensorItem).HardwareSpeedSensorType = Adapter.HardwareSpeedSensorTypes.FirstOrDefault(x => x.Guid == item.ItemGuid);
+ CreateElement<SpeedSensorElementEditor>(item);
+ }
}
/// <summary>
@@ -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 + ".");
}
}