Beispiel #1
0
        public void Reset()
        {
            listViewData.Items.Clear();
            listViewData.Groups.Clear();
            Site st;
            int  idx = 0;

            while (sites.GetAt(idx++, out st))
            {
                ListViewGroup lvg = new ListViewGroup();
                lvg.Tag    = st;
                lvg.Header = st.name + "(" + st.num.ToString() + ")";
                lvg.Name   = st.num.ToString();
                listViewData.Groups.Add(lvg);
                Sensor ss;
                int    j = 0;
                while (st.GetAt(j++, out ss))
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = "";
                    lvi.SubItems.Add(ss.name);
                    lvi.SubItems.Add(Sensor.items[ss.type]);
                    lvi.SubItems.Add("");
                    lvi.SubItems.Add(ss.alarmHigh == Decimal.MaxValue ? "" : ss.alarmHigh.ToString());
                    lvi.SubItems.Add(ss.alarmLow == Decimal.MinValue ? "" : ss.alarmLow.ToString());
                    lvi.SubItems.Add("");
                    lvg.Items.Add(lvi);
                    ListViewItem      newLvi = listViewData.Items.Add(lvi);
                    SensorDataHandler sdh    = new SensorDataHandler(st.num, ss, newLvi);
                    UiUpdater         uu     = new UiUpdater(st.num, ss.num, sdh.UpdateData);
                    sdh.uu = uu;
                }
            }
        }
Beispiel #2
0
 public DataUpdate(Site site, Sensor sensor, ListView listView, ToolStripTextBox toolStripEditMax)
 {
     st            = site;
     ss            = sensor;
     this.listView = listView;
     max           = toolStripEditMax;
     uu            = new UiUpdater(site.num, sensor.num, DataCome);
 }
Beispiel #3
0
        public void Start()
        {
            Site st;
            int  i = 0;

            while (sites.GetAt(i++, out st))
            {
                UiUpdater.StateUpdate(st.num, STATE.CONNECTING);
            }

            recvThread = new Thread(new ThreadStart(RecvProc));
            recvThread.Start();
        }
Beispiel #4
0
        public SensorMsgForm(uint siteNum, Sensor ss)
        {
            InitializeComponent();
            sensor = ss;
//             slf = new SensorLineForm();
//             slf.TopLevel = false;
//             splitContainer1.Panel2.Controls.Add(slf);
//             slf.Dock = DockStyle.Fill;
//             slf.Show();
            uu = new UiUpdater(siteNum, ss.num, UpdateUI);
            textBoxSensorNum.Text  = ss.num.ToString();
            textBoxSensorName.Text = ss.name;
            textBoxType.Text       = Sensor.items[ss.type];
        }
Beispiel #5
0
        public void RefreshForms()
        {
            Sensor ss;
            int    i = 0;

            while (site.GetAt(i++, out ss))
            {
                SensorMsgForm smf = new SensorMsgForm(site.num, ss);
                smfs.Add(ss.num, smf);
                smf.TopLevel = false;
                flowLayoutPanel2.Controls.Add(smf);
                smf.Show();
            }
            uu = new UiUpdater(site.num, UptateState);
        }
Beispiel #6
0
 public void RecvProc()
 {
     while (!bStop)
     {
         try
         {
             Site   st;
             Sensor ss;
             int    i = 0;
             while (sites.GetAt(i++, out st))
             {
                 int j = 0;
                 while (st.GetAt(j++, out ss))
                 {
                     double   data_origion;
                     double   data;
                     DateTime time;
                     if (ss.type == SENSOR_TYPE.GUANDAO || ss.type == SENSOR_TYPE.MINGQU)
                     {
                         double sum;
                         //if (DbClient.QueryRecentSum(st.num,ss.num,out data,out time))
                         if (DbClient.QueryRecentAvg(st.num, ss.num, 10, out data_origion, out data, out time) &&
                             DbClient.QueryRecentSum(st.num, ss.num, out sum, out time))
                         {
                             UiUpdater.DataInQueue(st.num, ss.num, data_origion, data, data * 3600, sum, time);
                         }
                     }
                     else if (DbClient.QueryRecentAvg(st.num, ss.num, 10, out data_origion, out data, out time))
                     {
                         UiUpdater.DataInQueue(st.num, ss.num, data_origion, data, data, 0, time);
                     }
                 }
             }
         }
         catch (System.Exception ex)
         {
             Thread.Sleep(5 * 1000);
         }
         //Thread.Sleep(5*1000);
         Thread.Sleep(1000);
     }
 }
Beispiel #7
0
 private void FormSensorIcon_Load(object sender, EventArgs e)
 {
     uu = new UiUpdater(siteNum, ss.num, UpdateColor);
 }
Beispiel #8
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     UiUpdater.DataUpdate();
 }
Beispiel #9
0
 private void ErrorForm_Load(object sender, EventArgs e)
 {
     uu = new UiUpdater(IsDataRight);
 }