public Item(int ItemID,ModbusTCP.IRTU rtu,string ItemType,tblItemConfig ItemConfig) { this.rtu = rtu; this.ItemConfig = ItemConfig; this.ItemType = ItemType; this.ItemID = ItemID; this._Value = ItemConfig.Value??0; this._Degree = ItemConfig.Degree; new System.Threading.Thread(ReadindAction).Start(); // Task task = Task.Run(new Action(ReadindAction)); }
public void LoadItemConfig() { SecureDBEntities1 client = new SecureDBEntities1(); tblItemConfig config= client.tblItemConfig.Where(n => n.ItemID == this.ItemID).FirstOrDefault(); if(config!=null) this.ItemConfig = config; if (this.ItemValueChanged != null) this.ItemValueChanged(this, this.Value); }