private void ModbusDevice_OnChangeState(object sender, TemperatureDevice.TemperatureDeviceState e) { switch (e) { case TemperatureDevice.TemperatureDeviceState.CheckConnection: lblDevice.Caption = "Проверка соединения с устройством"; break; case TemperatureDevice.TemperatureDeviceState.FindPortName: lblDevice.Caption = "Поиск COM порта"; break; case TemperatureDevice.TemperatureDeviceState.Read: lblDevice.Caption = "Чтение с устройства"; break; case TemperatureDevice.TemperatureDeviceState.StopRead: lblDevice.Caption = "Приостановлено чтение с устройства"; break; case TemperatureDevice.TemperatureDeviceState.Idle: lblDevice.Caption = "Отключение устройства"; break; } }
private void Device_OnChangeState(object sender, TemperatureDevice.TemperatureDeviceState e) { if (e == TemperatureDevice.TemperatureDeviceState.Read) { StatusChanged?.Invoke(this, true); } else if (e == TemperatureDevice.TemperatureDeviceState.Idle) { StatusChanged?.Invoke(this, false); } }