public WatchItem(int index, ESignalType type) { this.index = index; this.signalType = type; switch (type) { case ESignalType.DI: DIStruct signaldi = DIStruct.FindByIndex(index); signaldi.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.AI: AIStruct signalai = AIStruct.FindByIndex(index); signalai.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.DO: DOStruct signaldo = DOStruct.FindByIndex(index); signaldo.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.AO: AOStruct signalao = AOStruct.FindByIndex(index); signalao.PropertyChanged += Signal_PropertyChanged; break; } }
/// <summary> /// актуализировать привязку /// </summary> public void RefreshLink() { if (index > -1) { switch (signalType) { case ESignalType.DI: DIStruct signaldi = DIStruct.FindByIndex(index); signaldi.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.AI: AIStruct signalai = AIStruct.FindByIndex(index); signalai.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.DO: DOStruct signaldo = DOStruct.FindByIndex(index); signaldo.PropertyChanged += Signal_PropertyChanged; break; case ESignalType.AO: AOStruct signalao = AOStruct.FindByIndex(index); signalao.PropertyChanged += Signal_PropertyChanged; break; } } }
/// <summary> /// Обновление ссылок /// </summary> public void UpdateRefs() { ABB = DOStruct.FindByIndex(_ABBindxArrDO); ABO = DOStruct.FindByIndex(_ABOindxArrDO); ABO2 = DOStruct.FindByIndex(_ABO2indxArrDO); MBC12 = DIStruct.FindByIndex(_MBC12indxArrDI); MBC22 = DIStruct.FindByIndex(_MBC22indxArrDI); ECB = DIStruct.FindByIndex(_ECBindxArrDI); ECO = DIStruct.FindByIndex(_ECO12indxArrDI); CT_AI = AIStruct.FindByIndex(_CTindxArrDI); MBC11 = DIStruct.FindByIndex(_MBC11indxArrDI); MBC21 = DIStruct.FindByIndex(_MBC21indxArrDI); ECx = DIStruct.FindByIndex(_ECxindxArrDI); ECO11 = DIStruct.FindByIndex(_ECO11indxArrDI); EC = DIStruct.FindByIndex(_ECindxArrDI); /*current = AIStruct.FindByIndex(_current_indexArrAi); * RPM = AIStruct.FindByIndex(_RPMindxArrAI);*/ }