private void ledSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { ledTextBox.Text = ((int)ledSlider.Value).ToString(); #if !NoHardware Led led = Led.GetInstance(); led.DAout((int)ledSlider.Value, parameterManager); #endif }
private void ledTextBox_TextChanged(object sender, TextChangedEventArgs e) { try { int val = int.Parse(ledTextBox.Text); if (val < 0 && val > 255) { throw new ArgumentOutOfRangeException(); } Led led = Led.GetInstance(); led.DAout(val, parameterManager); ledTextBox.Background = Brushes.White; } catch (Exception) { ledTextBox.Background = Brushes.Pink; } }
private void ledTextBox_TextChanged(object sender, TextChangedEventArgs e) { try { int ledValue = int.Parse(ledTextBox.Text); if (ledValue < 0 || ledValue > 255) { throw new ArgumentOutOfRangeException(); } ledSlider.Value = ledValue; #if !NoHardware Led led = Led.GetInstance(); led.DAout(ledValue, parameterManager); #endif } catch (Exception) { ledTextBox.Background = Brushes.Pink; } }