public PowerMeterManager()
      {

        

          SecureDBEntities1 db=new SecureDBEntities1();
          var q = from n in db.tblPowerMeter select n;
          foreach (tblPowerMeter tbl in q)
          {
              list.Add(new R23PowerMeter(tbl.ERID,tbl.RTU_IP,tbl.Port));

          }
         // OneHourTmr_OnElapsed(null);
          new System.Threading.Thread(ReadingTask).Start();
           
          OneHourTmr = new ExactIntervalTimer(10,0);
          OneHourTmr.OnElapsed += OneHourTmr_OnElapsed;
          
      }
Beispiel #2
0
        public ItemManager()
        {


            SecureDBEntities1 db = new SecureDBEntities1();
            var q = from n in db.tblItemConfig  select n;
            foreach (tblItemConfig tblitem in q)
            {
                Item item = new Item(tblitem.ItemID, SecureService.rtu_mgr[tblitem.ControlID], tblitem.Type, tblitem);
              //  item.Value = tblitem.Value ?? 0;
                Items.Add(tblitem.ItemID,item);
                item.ItemValueChanged += item_ItemValueChanged;
                item.ItemDegreeChanged += item_ItemDegreeChanged;
               
            }

            OneHourTmr = new ExactIntervalTimer(5, 0);
            OneHourTmr.OnElapsed += OneHourTmr_OnElapsed;
           // db.Dispose();
        }