void sinkRegisterIsos() { var tEngs = TheThingRegistry.GetBaseEnginesAsThing(false, true); foreach (var t in tEngs) { if (TheThing.GetSafePropertyBool(t, "IsIsolated")) { IBaseEngine tBase = TheThingRegistry.GetBaseEngine(t, true); if (tBase != null && tBase.GetISOLater() != null) { TheThing tT = TheThingRegistry.GetThingByFunc(MyBaseEngine.GetEngineName(), s => s.DeviceType == TheISOlaterKPIs.eDeviceType && TheThing.GetSafePropertyString(s, "ISOLaterName") == t.EngineName); var tKPI = new TheISOlaterKPIs(tT, this, t.EngineName); TheThingRegistry.RegisterThing(tKPI); } } } List <TheThing> tDevList = TheThingRegistry.GetThingsByProperty(MyBaseEngine.GetEngineName(), Guid.Empty, "DeviceType", TheKPIReport.eDeviceType); if (tDevList.Count > 0) { foreach (TheThing tDev in tDevList) { if (tDev.GetObject() == null) { TheKPIReport cs = new TheKPIReport(tDev, this); TheThingRegistry.RegisterThing(cs); } } } }
private void InitRules() { bool FoundOne = false; List <TheThing> tDevList = TheThingRegistry.GetThingsByProperty(MyBaseEngine.GetEngineName(), Guid.Empty, "DeviceType", eKnownDeviceTypes.TheThingRule); if (tDevList != null && tDevList.Count > 0) { FoundOne = true; foreach (TheThing tDev in tDevList) { if (tDev.GetObject() == null) { TheRule tRule = new TheRule(tDev, this); if (string.IsNullOrEmpty(tRule.TriggerObjectType)) { tRule.TriggerObjectType = "CDE_THING"; } tRule.RegisterEvent(eEngineEvents.ThingUpdated, sinkUpdated); RegisterRule(tRule); } } } if (!FoundOne) { TheRule MyRule = new TheRule(new TheThing() { cdeMID = new Guid("{0D9741E6-7915-434F-89E6-15FA584E5F66}") }, this) { FriendlyName = "My First Rule", TriggerObjectType = "CDE_THING", TriggerObject = "", TriggerProperty = "Value", TriggerCondition = eRuleTrigger.Set, TriggerValue = "", ActionObjectType = "CDE_THING", ActionObject = "", ActionProperty = "Value", ActionValue = "", IsRuleActive = false, Parent = MyBaseThing.ID }; RegisterRule(MyRule); } }