private void CheckBoxChanged(object sender, RoutedEventArgs e) { var value = RootCheckBox.IsChecked == true; if (_setting.GetValue() is bool currentValue && value != currentValue) { _setting.SetValue(value); } }
protected override NewLineSetting GetCurrentValue() { return(_setting.GetValue() switch { "\n" => NewLineSetting.Newline, "\r" => NewLineSetting.CarrageReturn, "\r\n" => NewLineSetting.CarrageReturnNewline, _ => NewLineSetting.NotSet, });
protected override TabSizeSettings GetCurrentValue() { return(_setting.GetValue() switch { 1 => TabSizeSettings._1, 2 => TabSizeSettings._2, 3 => TabSizeSettings._3, 4 => TabSizeSettings._4, 5 => TabSizeSettings._5, 6 => TabSizeSettings._6, 7 => TabSizeSettings._7, _ => TabSizeSettings._8, });
protected override IndentationSizeSetting GetCurrentValue() { return(_setting.GetValue() switch { 1 => IndentationSizeSetting._1, 2 => IndentationSizeSetting._2, 3 => IndentationSizeSetting._3, 4 => IndentationSizeSetting._4, 5 => IndentationSizeSetting._5, 6 => IndentationSizeSetting._6, 7 => IndentationSizeSetting._7, _ => IndentationSizeSetting._8, });
public FormattingBoolSettingView(FormattingSetting setting) { InitializeComponent(); RootCheckBox.SetValue(AutomationProperties.NameProperty, ServicesVSResources.Value); _setting = setting; if (setting.GetValue() is bool value) { RootCheckBox.IsChecked = value; } RootCheckBox.Checked += CheckBoxChanged; RootCheckBox.Unchecked += CheckBoxChanged; }
protected override BinaryOperatorSpacingOptions GetCurrentValue() { return((BinaryOperatorSpacingOptions)_setting.GetValue() !); }
protected override LabelPositionOptions GetCurrentValue() { return((LabelPositionOptions)_setting.GetValue() !); }