Exemple #1
0
 private void updateTimer_Tick(object sender, EventArgs e)
 {
     if (_device.IsConnected)
     {
         bool hasAnAddLine = false;
         for (int i = 0; i < _sensorLines.Length; i++)
         {
             SensorSetupLine setupLine = _sensorLines[i];
             ISensor         sensor    = _device.GetSensor(i);
             IReading        reading   = sensor.IsValid ? sensor.GetCurrentReading() : null;
             if (null != reading && reading.IsValid)
             {
                 setupLine.Status  = SensorStatus.Connected;
                 setupLine.Enabled = true;
             }
             else
             {
                 setupLine.Status  = SensorStatus.Disconnected;
                 setupLine.Enabled = !hasAnAddLine;
                 hasAnAddLine      = true;
             }
         }
     }
     else
     {
         for (int i = 0; i < _sensorLines.Length; i++)
         {
             _sensorLines[i].Status  = SensorStatus.Unknown;
             _sensorLines[i].Enabled = false;
         }
     }
 }
Exemple #2
0
 private void SensorSetupDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (null != _device && _device.IsConnected)
     {
         int highestIndex = -1;
         for (int i = 0; i < _sensorLines.Length; i++)
         {
             SensorSetupLine setupLine = _sensorLines[i];
             ISensor         sensor    = _device.GetSensor(i);
             IReading        reading   = sensor.IsValid ? sensor.GetCurrentReading() : null;
             if (null != reading && reading.IsValid && i > highestIndex)
             {
                 highestIndex = i;
             }
         }
         if (highestIndex < 0)
         {
             highestIndex = _sensorLines.Length - 1;
         }
         _device.SetNetworkSize(highestIndex + 1);
     }
 }
Exemple #3
0
 public void Update(ISensor sensor)
 {
     SetValues(sensor, null == sensor ? null : sensor.GetCurrentReading());
 }
Exemple #4
0
 public void Update(ISensor sensor)
 {
     SetValues(sensor, null == sensor ? null : sensor.GetCurrentReading());
 }