diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-07 15:18:09 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-07 15:18:09 +0200 |
| commit | 9a10cf4ba24ab43140b0310213b575c0d2131b0c (patch) | |
| tree | 2836055e4c41d7f38393d51402b0bcfd65a8cd46 /Software/Visual_Studio/Tango.Touch | |
| parent | 6c56b49d815afa016a4ce74eed3e4b983c8a161c (diff) | |
| download | Tango-9a10cf4ba24ab43140b0310213b575c0d2131b0c.tar.gz Tango-9a10cf4ba24ab43140b0310213b575c0d2131b0c.zip | |
Color Selection Dialog . Save color space on select tab., White color saving.
Related Work Items: #6277
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
3 files changed, 44 insertions, 11 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.cs index a2a7a1c05..adb98d91d 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.cs @@ -20,7 +20,8 @@ namespace Tango.Touch.Controls { public const string Number_PART = "Number_PART"; private TouchNumericTextBox _numericValue; - + private bool _changedFromAnotherControl; + #region Properties public double Value @@ -58,7 +59,7 @@ namespace Tango.Touch.Controls /// </summary> public static readonly DependencyProperty MaxValueProperty = DependencyProperty.Register("MaxValue", typeof(double), typeof(TouchNumericUpDownConrol), new PropertyMetadata(100.0)); - + #endregion #region Commands @@ -95,6 +96,7 @@ namespace Tango.Touch.Controls DecrementCommand = new RelayCommand(() => { Value -= 1; }, (x) => { return (Value - 1) >= MinValue; }); + _changedFromAnotherControl = false; } @@ -126,7 +128,18 @@ namespace Tango.Touch.Controls { Value = _numericValue.Value; } - + + public void SetValueAnotherControl(double newValue) + { + if(Value != newValue) + { + _changedFromAnotherControl = true; + Value = newValue; + _changedFromAnotherControl = false; + } + + } + private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TouchNumericUpDownConrol colorPickerNumericUpDown = (TouchNumericUpDownConrol)d; @@ -137,6 +150,9 @@ namespace Tango.Touch.Controls private void OnValueNumberChanged(double? oldValue, double? newValue) { + if (_changedFromAnotherControl) + return; + RoutedPropertyChangedEventArgs<double?> args = new RoutedPropertyChangedEventArgs<double?>(oldValue, newValue); args.RoutedEvent = TouchNumericUpDownConrol.ColorNumberChangedEvent; RaiseEvent(args); diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs index ab319b479..4b494491e 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs @@ -216,23 +216,25 @@ namespace Tango.Touch.Controls { if (_colorPickerSlider != null && _colorPickerSlider.Value != (double)e.NewValue) { - _colorPickerSlider.Value = (double)e.NewValue; + _colorPickerSlider.SetValueAnotherControl((double)e.NewValue); OnPickerSliderValueChanged((double)e.OldValue, (double)e.NewValue); } } public void ColorPickerSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { - if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero)) + var newvalue = Math.Round(e.NewValue, 0, MidpointRounding.AwayFromZero); + if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != newvalue) { - _colorPickerNumericUpDown.Value = Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero); + _colorPickerNumericUpDown.SetValueAnotherControl(newvalue); OnPickerSliderValueChanged(e.OldValue, e.NewValue); } } + private void OnPickerSliderValueChanged(double oldValue, double newValue) { ColorValue = newValue; - RoutedPropertyChangedEventArgs<double> args = new RoutedPropertyChangedEventArgs<double>(oldValue, newValue); + RoutedPropertyChangedEventArgs<double> args = new RoutedPropertyChangedEventArgs<double>(oldValue, newValue);//Used in parent controls args.RoutedEvent = TouchColorPickerControl.PickerSliderValueChangedEvent; RaiseEvent(args); } diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs index 7b0f5881a..fb07ee976 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs @@ -16,6 +16,7 @@ namespace Tango.Touch.Controls #region Members private Border _colorPickerDisplay; + private bool _changedFromAnotherControl; #endregion static TouchColorPickerSlider() @@ -117,19 +118,21 @@ namespace Tango.Touch.Controls #endregion - + #region Base Class Overrides public override void OnApplyTemplate() { base.OnApplyTemplate(); + _changedFromAnotherControl = false; _colorPickerDisplay = (Border)GetTemplateChild(PART_ColorPickerDisplay); _colorPickerDisplay.BorderBrush = new SolidColorBrush(SliderBorderColor); TouchDown -= TouchDownSlider; TouchDown += TouchDownSlider; OnValueChanged(Double.NaN, Value); IsMoveToPointEnabled = true; + } private void TouchDownSlider(object sender, TouchEventArgs e) @@ -146,9 +149,12 @@ namespace Tango.Touch.Controls { base.OnValueChanged(oldValue, newValue); - RoutedPropertyChangedEventArgs<double> args = new RoutedPropertyChangedEventArgs<double>(oldValue, newValue); - args.RoutedEvent = TouchColorPickerSlider.PickerSliderValueChangedEvent; - RaiseEvent(args); + if (!_changedFromAnotherControl) + { + RoutedPropertyChangedEventArgs<double> args = new RoutedPropertyChangedEventArgs<double>(oldValue, newValue); + args.RoutedEvent = TouchColorPickerSlider.PickerSliderValueChangedEvent; + RaiseEvent(args); + } } #endregion @@ -171,6 +177,15 @@ namespace Tango.Touch.Controls #endregion #region Methods + public void SetValueAnotherControl(double newValue) + { + if (Value != newValue) + { + _changedFromAnotherControl = true; + Value = newValue; + _changedFromAnotherControl = false; + } + } #endregion //Methods } |
