diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-03 22:47:14 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-03 22:47:14 +0300 |
| commit | afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69 (patch) | |
| tree | daa087c9ed287ec83df167fcbb92dd973f38904b /Software/Visual_Studio/Tango.Touch | |
| parent | 507557c575f9e0cd53a288415d8dd92f7a001b36 (diff) | |
| download | Tango-afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69.tar.gz Tango-afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69.zip | |
Fixed rounding of liquid volumes CMYK and numeric controls.
Better support for TS-1800 waste replace process.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
4 files changed, 31 insertions, 30 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 6c09cdc59..66433afc4 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -112,13 +112,13 @@ namespace Tango.Touch.Controls } public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(null)); - + public double Step { get { return (double)GetValue(StepProperty); } set { SetValue(StepProperty, value); } } - + public static readonly DependencyProperty StepProperty = DependencyProperty.Register("Step", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(null)); @@ -154,7 +154,7 @@ namespace Tango.Touch.Controls set { SetValue(RippleBrushProperty, value); } } public static readonly DependencyProperty RippleBrushProperty = - DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchNumericTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(189,189,189)) { Opacity = 0.28 })); + DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchNumericTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(189, 189, 189)) { Opacity = 0.28 })); public virtual bool HasError @@ -164,7 +164,7 @@ namespace Tango.Touch.Controls return Validation.GetHasError(this); } } - + public override void OnApplyTemplate() { @@ -214,7 +214,7 @@ namespace Tango.Touch.Controls int coef = (int)((value + Step - 1) / Step); value = coef * Step; } - if(Minimum > 0 && value < Minimum) + if (Minimum > 0 && value < Minimum) { value = Minimum; } @@ -229,7 +229,7 @@ namespace Tango.Touch.Controls { value = Maximum; } - + } } @@ -276,16 +276,16 @@ namespace Tango.Touch.Controls { _prevent_text_change = true; - if (StringFormat != null) - { - _text_box.Text = Value.ToString(StringFormat); - } - else - { - _text_box.Text = Value.ToString(); - } + //if (StringFormat != null) + //{ + // _text_box.Text = Value.ToString(StringFormat); + //} + //else + //{ + _text_box.Text = Value.ToString(); + //} - _text_block.Text = _text_box.Text; + _text_block.Text = Value.ToString(StringFormat); _prevent_text_change = false; } @@ -316,7 +316,7 @@ namespace Tango.Touch.Controls e.Handled = true; return; } - else if(e.Text == "." && HasDecimalPoint) + else if (e.Text == "." && HasDecimalPoint) { e.Handled = false; return; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml index 8eea1bfbe..7d997ee08 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml @@ -82,7 +82,7 @@ <Border Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" CornerRadius="2" Width="{Binding NumericPartWidth,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" > <local:TouchNumericTextBox x:Name="Number_PART" Margin="0 4 0 0" FontSize="20" HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True" - Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="0.##"/> + Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="N2"/> </Border> <Border Margin="10 0 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="80"> diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs index 20eb8b4e7..ba94ed30f 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs @@ -283,7 +283,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnCyanPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnCyanPropertyChanged((double)e.OldValue, (double)e.NewValue); } } @@ -300,7 +300,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnMagentaLabPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnMagentaLabPropertyChanged((double)e.OldValue, (double)e.NewValue); } } @@ -317,7 +317,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnYellowPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnYellowPropertyChanged((double)e.OldValue, (double)e.NewValue); } } private void OnYellowPropertyChanged(double oldValue, double newValue) @@ -333,7 +333,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnKeyPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnKeyPropertyChanged((double)e.OldValue, (double)e.NewValue); } } private void OnKeyPropertyChanged(double oldValue, double newValue) diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs index 4f8082413..ae94cf9ac 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs @@ -9,7 +9,7 @@ using System.Windows.Media; namespace Tango.Touch.Controls { - public class TouchColorPickerControl: Control + public class TouchColorPickerControl : Control { private const string PART_ColorPickerSlider = "PART_ColorPickerSlider"; private const string PART_ColorPickerNumericUpDown = "PART_ColorPickerNumericUpDown"; @@ -40,12 +40,13 @@ namespace Tango.Touch.Controls } } + public double MinValue { get { return (double)GetValue(MinValueProperty); } set { SetValue(MinValueProperty, value); } } - + /// <summary> /// The slider minimum value property /// </summary> @@ -58,7 +59,7 @@ namespace Tango.Touch.Controls get { return (double)GetValue(MaxValueProperty); } set { SetValue(MaxValueProperty, value); } } - + /// <summary> /// The slider maximum value property /// </summary> @@ -75,10 +76,10 @@ namespace Tango.Touch.Controls } public void OnMaxPropertyChanged() { - if(_colorPickerNumericUpDown != null) + if (_colorPickerNumericUpDown != null) _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 2, MidpointRounding.AwayFromZero); - if(_colorPickerSlider != null) - _colorPickerSlider.Maximum = MaxValue; + if (_colorPickerSlider != null) + _colorPickerSlider.Maximum = MaxValue; } @@ -204,7 +205,7 @@ namespace Tango.Touch.Controls { _colorPickerNumericUpDown.MinValue = MinValue; _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 2, MidpointRounding.AwayFromZero); - _colorPickerNumericUpDown.Value = Math.Round( ColorValue, 2, MidpointRounding.AwayFromZero); + _colorPickerNumericUpDown.Value = ColorValue; //Math.Round( ColorValue, 2, MidpointRounding.AwayFromZero); _colorPickerNumericUpDown.ColorNumberChanged += ColorPickerNumber_ValueChanged; } } @@ -222,7 +223,7 @@ namespace Tango.Touch.Controls } public void ColorPickerSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { - var newvalue = Math.Round(e.NewValue, 2, MidpointRounding.AwayFromZero); + var newvalue = e.NewValue;// Math.Round(e.NewValue, 2, MidpointRounding.AwayFromZero); if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != newvalue) { _colorPickerNumericUpDown.SetValueAnotherControl(newvalue); @@ -230,7 +231,7 @@ namespace Tango.Touch.Controls } } - + private void OnPickerSliderValueChanged(double oldValue, double newValue) { ColorValue = newValue; |
