Exemple #1
0
 public void UpdateData(UnitData data)
 {
     var measure = ConfigLayer.singleGraphConfigs;
     lblTemper1.Text = DataFormatStr(data.ErrorCode >> 0, false,
         "{0} "+ measure[0].curveMeasure, data.Term1);
     lblTemper2.Text = DataFormatStr(data.ErrorCode >> 2, false,
         "{0} " + measure[1].curveMeasure, data.Term2);
     lblPressure.Text = DataFormatStr(data.ErrorCode >> 4, true,
         "{0} "+ measure[2].curveMeasure, data.Pressure);
     lblLevel.Text = DataFormatStr(data.ErrorCode >> 6, true,
         "{0} "+ measure[3].curveMeasure, data.Level);
 }
Exemple #2
0
        public void UpdateData(UnitData data, bool isUpdateAxis)
        {
            for (int i = 0; i < 4; i++)
            {
                if(((data.ErrorCode>>(i*2))&3) == 0)
                    _singleGraph[i].UpdateData(data.GetValue(i), data.Time);
            }

            if (isUpdateAxis)
            {
                UpdateAsis(data.Time);
            }
        }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     List<UnitData> q = new List<UnitData>();
     UnitData c = new UnitData();
     c.Index = 2;
     c.Time = (XDate)DateTime.Now;
     c.Term1 = 50.1;
     c.Term2 = 52.3;
     c.Pressure = 11.2;
     c.Level = 5.54;
     c.ErrorCode = 0;
     q.Add(c);
     dbl.SaveDataList(q);
 }
Exemple #4
0
        public bool InterviewAllSensor() //Опрос всех сенсоров
        {
            if (_readDataTimer.Enabled) return false;

            for (int i = 0; i < ConfigLayer.unitCount; i++)
            {
                _unitsData[i] = new UnitData();
            }

            _readDataTimer.Enabled = true;
            _unitsIndex = 0;
            _waitTime = 0;
            _isWaitData = false;

            return true;
        }
Exemple #5
0
        private void ReceiviDataComplete(bool isPortOK, UnitData[] datas)
        {
            rtbStatus.Text = " ";

            rtfText rtf = new rtfText(rtbStatus);

            if (!isPortOK)
            {
                rtf.AppendText(Color.Red, string.Format("Порт {0} закрыт!", ConfigLayer.port));
                return;
            }

            DateTime curTime = DateTime.Now;

            for (int i = 0; i < ConfigLayer.unitCount; i++)
            {
                if (ConfigLayer.unitsConfig[i].isEnable)
                {
                    datas[i].Time = curTime;

                    if ((datas[i].ErrorCode & 0xFF00) == 0)
                    {
                        _dataBaseLayer.AddDataToCache(datas[i]);
                        rtf.AppendText(((datas[i].ErrorCode & 0xFF) == 0) ? Color.Green : Color.Orange, (i + 1).ToString());
                    }
                    else
                    {
                        rtf.AppendText(Color.Red, (i + 1).ToString());
                    }

                    _interfaceLayers[i].UpdateData(datas[i]);
                }
            }

            rtf.AppendText(Color.Gray, string.Format("at {0}", curTime));
        }
Exemple #6
0
 public void AddDataToCache(UnitData data)
 {
     _dataCache[_swapIndex].Add(data);
 }