From 0766ff8488c961c7f73eec50fb9ee64c89da5eb1 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 23 Mar 2023 13:33:53 +0200 Subject: Eureka. PPC. Job View changes. Basic mode. Summary view. --- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 20 ++++ .../Tango.Touch/Controls/TouchToggleSlider.cs | 53 ++++++++++- .../Tango.Touch/Controls/TouchToggleSlider.xaml | 105 ++++++++++++++++++++- 3 files changed, 172 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/Tango.Touch') diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 15c516124..47b3670a7 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -112,6 +112,17 @@ 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)); + + public double JoggingFactor { @@ -198,6 +209,14 @@ namespace Tango.Touch.Controls { value = Math.Round(value, 0); } + if (Step > 0) + { + value = Math.Round(value / Step, MidpointRounding.AwayFromZero) * Step; + } + if(Minimum > 0 && value < Minimum) + { + value = Minimum; + } if (Maximum > Minimum) { @@ -209,6 +228,7 @@ namespace Tango.Touch.Controls { value = Maximum; } + } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.cs index 79afdfaab..b1e7080fc 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.cs @@ -105,6 +105,48 @@ namespace Tango.Touch.Controls } public static readonly DependencyProperty CheckedThumbContentTemplateProperty = DependencyProperty.Register("CheckedThumbContentTemplate", typeof(DataTemplate), typeof(TouchToggleSlider), new PropertyMetadata(null)); + + public String LeftText + { + get { return (String)GetValue(LeftTextProperty); } + set { SetValue(LeftTextProperty, value); } + } + + public static readonly DependencyProperty LeftTextProperty = + DependencyProperty.Register("LeftText", typeof(String), typeof(TouchToggleSlider), new PropertyMetadata("")); + + public CornerRadius ThumbCornerRadius + { + get { return (CornerRadius)GetValue(ThumbCornerRadiusProperty); } + set { SetValue(ThumbCornerRadiusProperty, value); } + } + public static readonly DependencyProperty ThumbCornerRadiusProperty = + DependencyProperty.Register("ThumbCornerRadius", typeof(CornerRadius), typeof(TouchToggleSlider), new PropertyMetadata(default(CornerRadius))); + + public String RightText + { + get { return (String)GetValue(RightTextProperty); } + set { SetValue(RightTextProperty, value); } + } + + // Using a DependencyProperty as the backing store for RightText. This enables animation, styling, binding, etc... + public static readonly DependencyProperty RightTextProperty = + DependencyProperty.Register("RightText", typeof(String), typeof(TouchToggleSlider), new PropertyMetadata("")); + + + + public int ThumbWidth + { + get { return (int)GetValue(ThumbWidthProperty); } + set { SetValue(ThumbWidthProperty, value); } + } + + // Using a DependencyProperty as the backing store for ThumbWidth. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ThumbWidthProperty = + DependencyProperty.Register("ThumbWidth", typeof(int), typeof(TouchToggleSlider), new PropertyMetadata(0)); + + + public TouchToggleSlider() { @@ -120,6 +162,7 @@ namespace Tango.Touch.Controls { base.OnApplyTemplate(); _grid_ellipse = GetTemplateChild("PART_GridEllipse") as Grid; + SetThumbPosition(); } protected override void OnChecked(RoutedEventArgs e) @@ -143,7 +186,15 @@ namespace Tango.Touch.Controls if (IsChecked.Value) { - ani.To = new Thickness(ActualWidth - _grid_ellipse.ActualWidth - 4, 0, 0, 0); + if (ActualWidth != 0 && _grid_ellipse.ActualWidth == 0) + { + ani.To = new Thickness(ActualWidth - (ActualWidth/2) - 4, 0, 0, 0); + } + else + { + ani.To = new Thickness(ActualWidth - _grid_ellipse.ActualWidth - 4, 0, 0, 0); + } + } else { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml index 7d26fdcff..adb76ebd3 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml @@ -62,7 +62,7 @@ - + @@ -133,16 +133,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -150,7 +245,7 @@ - + -- cgit v1.3.1