private void UpdateUx(TheThing pThing) { ThePropertyBag.MergeUXBagFromProperties(MySampleControl?.PropertyBag, pThing); SetCtrlType(); TheThingRegistry.UnmapPropertyMapper(MapperGuid); if (!string.IsNullOrEmpty(pThing.Address)) { MapperGuid = TheThingRegistry.PropertyMapper(TheCommonUtils.CGuid(pThing.Address), TheThing.GetSafePropertyString(pThing, "SourceProp"), pThing.cdeMID, "Value", true); if (MapperGuid != Guid.Empty) { pThing.StatusLevel = 1; pThing.LastMessage = "Mapper engaged"; } else { pThing.StatusLevel = 2; pThing.LastMessage = "Mapper failed to engaged"; } } else { pThing.StatusLevel = 0; pThing.LastMessage = "Mapper not engaged"; } }
private void UpdateUx() { ThePropertyBag.MergeUXBagFromProperties(CountBar?.PropertyBag, MyBaseThing); SetCtrlType(); if (TimestampField != null) { TimestampField?.SetUXProperty(Guid.Empty, $"Visibility={ShowTimestamp}"); ChangeTimestampField?.SetUXProperty(Guid.Empty, $"Visibility={ShowChangeTimestamp}"); } TheThingRegistry.UnmapPropertyMapper(MapperGuid); if (!string.IsNullOrEmpty(MyBaseThing.Address)) { MapperGuid = TheThingRegistry.PropertyMapper(TheCommonUtils.CGuid(MyBaseThing.Address), TheThing.GetSafePropertyString(MyBaseThing, "SourceProp"), MyBaseThing.cdeMID, "Value", true); if (MapperGuid != Guid.Empty) { MyBaseThing.StatusLevel = 1; MyBaseThing.LastMessage = "Mapper engaged"; } else { MyBaseThing.StatusLevel = 2; MyBaseThing.LastMessage = "Mapper failed to engaged"; } } else { MyBaseThing.StatusLevel = 0; MyBaseThing.LastMessage = "Mapper not engaged"; } }
public override void DoCreateUX(TheFormInfo tMyForm, ThePropertyBag pChartsBag = null) { base.DoCreateUX(tMyForm); AddSpeedGauge(tMyForm); var tEngage = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 25012, 2, 0xC0, "Restart KPI", null, new nmiCtrlNumber { ParentFld = TheDefaultSensor.SensorActionArea, TileWidth = 6, NoTE = true }); tEngage.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "reset", (sender, para) => { EngageMapper(); }); var tRemove = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 25013, 2, 0xC0, "Delete this KPI Report", null, new nmiCtrlNumber { ParentFld = TheDefaultSensor.SensorActionArea, TileWidth = 6, NoTE = true }); tRemove.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "remove", (sender, para) => { TheThing tT = TheThingRegistry.GetThingByID(MyBaseEngine.GetEngineName(), MyBaseThing.ID); if (tT != null) { TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); TheThingRegistry.DeleteThing(tT); } }); }
private void EngageMapper() { TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); mRealThingGuid = TheThingRegistry.PropertyMapper(TheThing.GetSafePropertyGuid(MyBaseThing, "ValueGuid"), TheThing.GetSafePropertyString(MyBaseThing, "ValueProp"), MyBaseThing.cdeMID, "ValueStr", false); if (mRealThingGuid == Guid.Empty) { MyBaseThing.StatusLevel = 0; MyBaseThing.LastMessage = "Mapper not active"; } else { MyBaseThing.LastMessage = "Mapper engaged"; MyBaseThing.StatusLevel = 1; } }
protected override void SensorCyclicCalc(long timer) { base.SensorCyclicCalc(timer); if (MyBaseThing.StatusLevel != 0 && IsDisabled) { MyBaseThing.StatusLevel = 0; MyBaseThing.LastMessage = "V-Sensor disabled"; TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); } if (MyBaseThing.StatusLevel == 0 && !IsDisabled) { MyBaseThing.StatusLevel = 1; MyBaseThing.LastMessage = "V-Sensor Enabled"; EngageMapper(); } }
private void EngageMapper() { TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); mRealThingGuid = TheThingRegistry.PropertyMapper(TheThing.GetSafePropertyGuid(MyBaseThing, "RealSensorThing"), TheThing.GetSafePropertyString(MyBaseThing, "RealSensorProperty"), MyBaseThing.cdeMID, "Value", false); if (mRealThingGuid == Guid.Empty) { MyBaseThing.StatusLevel = 0; MyBaseThing.LastMessage = "Mapper not active"; IsActive = false; } else { MyBaseThing.LastMessage = "Mapper engaged"; MyBaseThing.StatusLevel = 1; CopyStateSensorInfo(MyBaseThing); IsActive = true; } }
private void EngageMapper() { TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); mRealThingGuid = TheThingRegistry.PropertyMapper(TheThing.GetSafePropertyGuid(MyBaseThing, "RealSensorThing"), TheThing.GetSafePropertyString(MyBaseThing, "RealSensorProperty"), MyBaseThing.cdeMID, "RawValue", false); if (mRealThingGuid == Guid.Empty) { MyBaseThing.StatusLevel = 0; MyBaseThing.LastMessage = "Mapper not active"; IsActive = false; } else { MyBaseThing.LastMessage = "Mapper engaged"; MyBaseThing.StatusLevel = 1; TheDefaultSensor.CopyStateSensorInfo(MyBaseThing); SummaryForm?.SetUXProperty(Guid.Empty, string.Format("Background={0}", TheNMIEngine.GetStatusColor(MyBaseThing.StatusLevel))); IsActive = true; } }