From c8890c60c3ee1d9f33606d272fdc45e6f7f5ef3f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Jun 2018 11:16:50 +0300 Subject: Working on PPC job view gradients.. --- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 200 ++++++++++++++------- 1 file changed, 135 insertions(+), 65 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index d66005016..11a32dca8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -25,8 +25,6 @@ - - @@ -129,80 +127,152 @@ - - - - - - - - - - - - - - + + + + + + + + + + Segment # - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #. + + + + + Color code: + + + + + Position (m): + + + - - - - - - - - - - - + + + + + -- cgit v1.3.1 From 50eb2f5147af4387f807872ae81dd50dfedbb86e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Jun 2018 18:03:20 +0300 Subject: Working on PPC!!! --- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 8 +- .../ExtensionMethods/DependencyObjectExtensions.cs | 2 +- .../Tango.Touch/Controls/FocusSelectionMode.cs | 15 + .../Tango.Touch/Controls/IValueControl.cs | 17 + .../Tango.Touch/Controls/TouchInput.cs | 8 + .../Tango.Touch/Controls/TouchNumericTextBox.cs | 220 +++++ .../Tango.Touch/Controls/TouchNumericTextBox.xaml | 119 +++ .../Tango.Touch/Controls/TouchPanel.cs | 4 + .../Tango.Touch/Controls/TouchTextBox.cs | 22 +- .../Converters/NumericTextBoxDoubleConverter.cs | 41 + .../Converters/NumericTextBoxIntegerConverter.cs | 41 + .../Tango.Touch/Keyboard/KeyboardView.xaml | 3 +- .../Tango.Touch/Keyboard/TouchKeyboard.cs | 122 +++ .../Tango.Touch/Keyboard/TouchKeyboard.xaml | 961 +++++++++++---------- .../Visual_Studio/Tango.Touch/Tango.Touch.csproj | 9 + .../Visual_Studio/Tango.Touch/Themes/Generic.xaml | 3 + .../Utilities/Tango.UITests/MainWindow.xaml | 11 + 17 files changed, 1163 insertions(+), 443 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/FocusSelectionMode.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/IValueControl.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml create mode 100644 Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxDoubleConverter.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 11a32dca8..899283b80 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -199,9 +199,9 @@ - - - + + + @@ -215,7 +215,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs index 13e19e2ac..4e07aa8b2 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs @@ -161,7 +161,7 @@ public static class DependencyObjectExtensions /// /// The dependency object. /// - public static T FindAncestor(this DependencyObject dependencyObject) where T : DependencyObject + public static T FindAncestor(this DependencyObject dependencyObject) where T : class { var parent = VisualTreeHelper.GetParent(dependencyObject); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/FocusSelectionMode.cs b/Software/Visual_Studio/Tango.Touch/Controls/FocusSelectionMode.cs new file mode 100644 index 000000000..d7330896a --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/FocusSelectionMode.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Touch.Controls +{ + public enum FocusSelectionMode + { + None, + SelectAll, + ScrollToEnd + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/IValueControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/IValueControl.cs new file mode 100644 index 000000000..86158f41c --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/IValueControl.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Touch.Controls +{ + public interface IValueControl + { + double Value { get; set; } + double Minimum { get; set; } + double Maximum { get; set; } + double JoggingFactor { get; set; } + bool AutoCalculateJogStep { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchInput.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchInput.cs index 82d74d838..f41dfe03c 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchInput.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchInput.cs @@ -34,5 +34,13 @@ namespace Tango.Touch.Controls } public static readonly DependencyProperty KeyboardContainerProperty = DependencyProperty.Register("KeyboardContainer", typeof(FrameworkElement), typeof(TouchInput), new PropertyMetadata(null)); + + public FocusSelectionMode FocusSelectionMode + { + get { return (FocusSelectionMode)GetValue(FocusSelectionModeProperty); } + set { SetValue(FocusSelectionModeProperty, value); } + } + public static readonly DependencyProperty FocusSelectionModeProperty = + DependencyProperty.Register("FocusSelectionMode", typeof(FocusSelectionMode), typeof(TouchInput), new PropertyMetadata(FocusSelectionMode.None)); } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs new file mode 100644 index 000000000..941cb392a --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -0,0 +1,220 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Touch.Controls +{ + public class TouchNumericTextBox : TouchInput, IValueControl + { + private TextBox _text_box; + private bool _prevent_text_change; + private TextBlock _text_block; + Regex regex_integer = new Regex(@"^[0-9]*(?:[0-9]*)?$"); + Regex regex_double = new Regex(@"^[0-9]*(?:\.[0-9]*)?$"); + + public double Value + { + get { return (double)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(double), typeof(TouchNumericTextBox), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => (d as TouchNumericTextBox).OnValueChanged(), (d, e) => (d as TouchNumericTextBox).CoerceValue(d, e), false, UpdateSourceTrigger.Explicit)); + + public String Watermark + { + get { return (String)GetValue(WatermarkProperty); } + set { SetValue(WatermarkProperty, value); } + } + public static readonly DependencyProperty WatermarkProperty = + DependencyProperty.Register("Watermark", typeof(String), typeof(TouchNumericTextBox), new PropertyMetadata(null)); + + public String StringFormat + { + get { return (String)GetValue(StringFormatProperty); } + set { SetValue(StringFormatProperty, value); } + } + public static readonly DependencyProperty StringFormatProperty = + DependencyProperty.Register("StringFormat", typeof(String), typeof(TouchNumericTextBox), new PropertyMetadata(null)); + + public bool HasDecimalPoint + { + get { return (bool)GetValue(HasDecimalPointProperty); } + set { SetValue(HasDecimalPointProperty, value); } + } + public static readonly DependencyProperty HasDecimalPointProperty = + DependencyProperty.Register("HasDecimalPoint", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(false)); + + public double Minimum + { + get { return (double)GetValue(MinimumProperty); } + set { SetValue(MinimumProperty, value); } + } + public static readonly DependencyProperty MinimumProperty = + DependencyProperty.Register("Minimum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(.0)); + + public double Maximum + { + get { return (double)GetValue(MaximumProperty); } + set { SetValue(MaximumProperty, value); } + } + public static readonly DependencyProperty MaximumProperty = + DependencyProperty.Register("Maximum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(100.0)); + + public double JoggingFactor + { + get { return (double)GetValue(JoggingFactorProperty); } + set { SetValue(JoggingFactorProperty, value); } + } + public static readonly DependencyProperty JoggingFactorProperty = + DependencyProperty.Register("JoggingFactor", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(1.0)); + + public bool AutoCalculateJogStep + { + get { return (bool)GetValue(AutoCalculateJogStepProperty); } + set { SetValue(AutoCalculateJogStepProperty, value); } + } + public static readonly DependencyProperty AutoCalculateJogStepProperty = + DependencyProperty.Register("AutoCalculateJogStep", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(true)); + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _text_box = GetTemplateChild("PART_TextBox") as TextBox; + _text_block = GetTemplateChild("PART_TextDisplay") as TextBlock; + _text_box.PreviewTextInput += _text_box_PreviewTextInput; + _text_box.PreviewKeyDown += _text_box_PreviewKeyDown; + _text_box.LostFocus += _text_box_LostFocus; + _text_box.GotFocus += _text_box_GotFocus; + _text_box.TextChanged += _text_box_TextChanged; + + OnValueChanged(); + } + + private async void _text_box_GotFocus(object sender, RoutedEventArgs e) + { + await Task.Delay(50); + + if (FocusSelectionMode == FocusSelectionMode.SelectAll) + { + _text_box.SelectAll(); + } + else if (FocusSelectionMode == FocusSelectionMode.ScrollToEnd) + { + _text_box.CaretIndex = _text_box.Text.Length; + } + } + + private object CoerceValue(DependencyObject d, object e) + { + double value = (double)e; + + if (!HasDecimalPoint) + { + value = Math.Round(value, 0); + } + + if (value < Minimum) + { + value = Minimum; + } + else if (value > Maximum) + { + value = Maximum; + } + + return value; + } + + private void _text_box_LostFocus(object sender, RoutedEventArgs e) + { + double d = 0.0; + + if (double.TryParse(_text_box.Text, out d)) + { + Value = d; + _text_box.Text = Value.ToString(); + } + + _text_block.Text = Value.ToString(StringFormat); + } + + private void _text_box_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Space) + { + e.Handled = true; + } + } + + private void OnValueChanged() + { + if (_text_box != null && !_prevent_text_change) + { + _text_box.Text = Value.ToString(); + + if (StringFormat != null) + { + _text_block.Text = Value.ToString(StringFormat); + } + else + { + _text_block.Text = Value.ToString(); + } + } + + BindingExpression b = GetBindingExpression(ValueProperty); + if (b != null) + { + b.UpdateSource(); + } + } + + private void _text_box_PreviewTextInput(object sender, TextCompositionEventArgs e) + { + if (e.Text == "." && _text_box.Text.Contains('.')) + { + e.Handled = true; + return; + } + + if (HasDecimalPoint) + { + e.Handled = !regex_double.IsMatch(e.Text); + } + else + { + e.Handled = !regex_integer.IsMatch(e.Text); + } + } + + private void _text_box_TextChanged(object sender, TextChangedEventArgs e) + { + double d = 0.0; + + if (double.TryParse(_text_box.Text, out d)) + { + _prevent_text_change = true; + Value = d; + _prevent_text_change = false; + } + } + + static TouchNumericTextBox() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchNumericTextBox), new FrameworkPropertyMetadata(typeof(TouchNumericTextBox))); + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml new file mode 100644 index 000000000..4d37ce1fd --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index affc0a2a0..a591f9748 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -9,6 +9,7 @@ using System.Windows.Controls; using System.Windows.Controls.Primitives; using Tango.Core.Commands; using Tango.Core.EventArguments; +using Tango.Touch.Keyboard; namespace Tango.Touch.Controls { @@ -35,6 +36,9 @@ namespace Tango.Touch.Controls private void OnMouseDown(object sender, MouseOrTouchEventArgs e) { + var element = e.OriginalSource as FrameworkElement; + if (element.Focusable) return; + Focus(); //TODO: Notice that this does not cause trouble. (Originally inserted for stealing focus from pop-ups) } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs index 8a7c907c9..b70750286 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs @@ -18,6 +18,8 @@ namespace Tango.Touch.Controls { public class TouchTextBox : TouchInput { + private TextBox _text_box; + public String Text { get { return (String)GetValue(TextProperty); } @@ -47,9 +49,27 @@ namespace Tango.Touch.Controls DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchTextBox), new FrameworkPropertyMetadata(typeof(TouchTextBox))); } - public TouchTextBox() + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _text_box = GetTemplateChild("PART_TextBox") as TextBox; + + _text_box.GotFocus += _text_box_GotFocus; + } + + private async void _text_box_GotFocus(object sender, RoutedEventArgs e) { + await Task.Delay(50); + if (FocusSelectionMode == FocusSelectionMode.SelectAll) + { + _text_box.SelectAll(); + } + else if (FocusSelectionMode == FocusSelectionMode.ScrollToEnd) + { + _text_box.CaretIndex = _text_box.Text.Length; + } } } } diff --git a/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxDoubleConverter.cs b/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxDoubleConverter.cs new file mode 100644 index 000000000..2d25e5050 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxDoubleConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.Touch.Converters +{ + public class NumericTextBoxDoubleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + double i = 0d; + if (double.TryParse(value.ToString(), out i)) + { + return i; + } + } + + return 0d; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + double i = 0d; + if (double.TryParse(value.ToString(), out i)) + { + return i; + } + } + + return ""; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs b/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs new file mode 100644 index 000000000..37040d1ce --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.Touch.Converters +{ + public class NumericTextBoxIntegerConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + int i = 0; + if (int.TryParse(value.ToString(), out i)) + { + return i; + } + } + + return 0; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + int i = 0; + if (int.TryParse(value.ToString(), out i)) + { + return i; + } + } + + return ""; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.xaml b/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.xaml index c23331eed..093eea083 100644 --- a/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.xaml +++ b/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.xaml @@ -4,6 +4,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + @@ -426,16 +479,16 @@ - - - - - - + + + + + + - - - + + + @@ -455,72 +508,108 @@ - - - - - - - - - - - - - - 1 - 2 - 3 - - - - - - 4 - 5 - 6 - - 7 - 8 - 9 - - - 0 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + + + + + + 4 + 5 + 6 + + 7 + 8 + 9 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 9f393898a..e3da98d52 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -60,6 +60,8 @@ Core.cs + + @@ -68,11 +70,14 @@ + + + @@ -143,6 +148,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index f987a0584..998f01fac 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -31,6 +31,7 @@ + @@ -38,6 +39,8 @@ + + diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index 8b6251200..f46a5f491 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -47,6 +47,17 @@ + + + + + + + + + + + -- cgit v1.3.1 From 9d5a18e590d7f892076a14d835962df5076d0172 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Jun 2018 18:43:45 +0300 Subject: Working on PPC --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 64 ++++++++++++++++----- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 34 ++++++----- .../Tango.Touch/Controls/TouchPanel.cs | 2 +- 5 files changed, 71 insertions(+), 29 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 887dc12d3..3f8e84e8b 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 449c40ee1..251cd8ee9 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 899283b80..c3817c5d1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -25,6 +25,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -195,17 +220,13 @@ - - - - - - - - - - - + + + + + + + @@ -259,12 +280,29 @@ Color code: - + + + + + Position (m): - + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 941cb392a..1453a38a6 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -121,18 +121,21 @@ namespace Tango.Touch.Controls { double value = (double)e; - if (!HasDecimalPoint) + if (_text_box != null) //Min and max not being set yet... { - value = Math.Round(value, 0); - } + if (!HasDecimalPoint) + { + value = Math.Round(value, 0); + } - if (value < Minimum) - { - value = Minimum; - } - else if (value > Maximum) - { - value = Maximum; + if (value < Minimum) + { + value = Minimum; + } + else if (value > Maximum) + { + value = Maximum; + } } return value; @@ -168,17 +171,18 @@ namespace Tango.Touch.Controls if (StringFormat != null) { _text_block.Text = Value.ToString(StringFormat); + _text_box.Text = Value.ToString(StringFormat); } else { _text_block.Text = Value.ToString(); } - } - BindingExpression b = GetBindingExpression(ValueProperty); - if (b != null) - { - b.UpdateSource(); + BindingExpression b = GetBindingExpression(ValueProperty); + if (b != null) + { + b.UpdateSource(); + } } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index a591f9748..d9c067045 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -37,7 +37,7 @@ namespace Tango.Touch.Controls private void OnMouseDown(object sender, MouseOrTouchEventArgs e) { var element = e.OriginalSource as FrameworkElement; - if (element.Focusable) return; + if (element != null && element.Focusable) return; Focus(); //TODO: Notice that this does not cause trouble. (Originally inserted for stealing focus from pop-ups) } -- cgit v1.3.1 From 3c76016cff1a5e5d9c2ad270a954056e77ea9ce8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 26 Jun 2018 13:54:56 +0300 Subject: Fixed issue on numeric text input. Updated machine studio update service to accept hashed passwords.. Added Job summery to job view. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../MachineStudioUpdateService.svc.cs | 7 +- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 101 +++++++++++++++++++-- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 5 + .../Tango.BL/EntitiesExtensions/Job.cs | 55 +++++++++++ .../Converters/OneToPercentConverter.cs | 23 +++++ .../Converters/SegmentLengthToWidthConverter.cs | 53 +++++++++++ .../Converters/WidthHeightToRectConverter.cs | 26 ++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 + .../Tango.Touch/Controls/TouchNumericTextBox.cs | 10 +- .../Tango.Touch/Controls/TouchNumericTextBox.xaml | 6 ++ .../Tango.Touch/Controls/TouchSlider.xaml | 14 +-- .../Visual_Studio/Tango.Touch/Resources/Fonts.xaml | 1 + 14 files changed, 279 insertions(+), 25 deletions(-) create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/OneToPercentConverter.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 3f8e84e8b..655618cca 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 251cd8ee9..3ca849535 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs index b90a03c1d..49521fb1d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs @@ -60,8 +60,7 @@ namespace Tango.MachineStudio.UpdateService db.UsersRoles.ToList(); db.RolesPermissions.ToList(); - String hash = User.GetPasswordHash(request.Password); - var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == hash); + var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); if (user != null && user.HasPermission(Permissions.RunMachineStudio) || (request.Email == "ForceUpdate")) { @@ -111,9 +110,7 @@ namespace Tango.MachineStudio.UpdateService db.UsersRoles.ToList(); db.RolesPermissions.ToList(); - String hash = User.GetPasswordHash(request.Password); - - var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == hash); + var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index c3817c5d1..c42435f94 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -13,7 +13,7 @@ xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" mc:Ignorable="d" - d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> + d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> - - - - - - - - - - - - - + + + + + + + + + + + + + + + #. - + + + + + Color code: + + + + + + + + + Position (m): + + + + + + + + + + - - - Color code: - - - - - - - - - Position (m): - - - - - - - - - - - + + + + + + + + + + - - - + + ADD COLOR + + + diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs index c4bbd0f65..ca77ca15d 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs @@ -32,6 +32,32 @@ namespace Tango.BL.Entities { BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); } + + if (propName == nameof(BrushStops)) + { + if (BrushStops != null) + { + BrushStops.CollectionChanged -= BrushStops_CollectionChanged; + BrushStops.CollectionChanged += BrushStops_CollectionChanged; + + foreach (var stop in BrushStops) + { + stop.RaiseOffsetChanged(); + } + + RaiseSegmentBrushChanged(); + } + } + } + + private void BrushStops_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + foreach (var stop in BrushStops) + { + stop.RaiseOffsetChanged(); + } + + RaiseSegmentBrushChanged(); } private TimeSpan _remainingTime; -- cgit v1.3.1 From a56ec33e5ca497d6433082c286c4cb75c965fe37 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 26 Jun 2018 16:11:36 +0300 Subject: Implemented Add solid & gradient segments. --- .../ViewModels/MainViewVM.cs | 2 +- .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 10 +---- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 45 ++++++++++++++++++++-- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Tango.BL/EntitiesExtensions/BrushStop.cs | 34 ++++++++++------ .../Tango.Integration/Operation/MachineOperator.cs | 2 +- 6 files changed, 69 insertions(+), 26 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 106848b7a..e2bba2d1d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1661,7 +1661,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } else { - stop.StopIndex = 0; + stop.StopIndex = 1; } stop.OffsetPercent = 100; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index 1769dd49d..c674b57fe 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -70,15 +70,7 @@ - - - - - - - - - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 15f438baf..3cb7c2322 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -99,6 +99,11 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand AddSolidSegmentCommand { get; set; } + /// + /// Gets or sets the add gradient segment command. + /// + public RelayCommand AddGradientSegmentCommand { get; set; } + /// /// Gets or sets the add brush stop command. /// @@ -114,14 +119,16 @@ namespace Tango.PPC.Jobs.ViewModels public JobViewVM() { RegisterForMessage(HandleJobSelectedMessage); - AddSolidSegmentCommand = new RelayCommand(AddSolidSegment); CustomersAutoCompleteProvider = new AutoCompleteProvider((customer, filter) => { return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); }); + //Initialize Commands + AddSolidSegmentCommand = new RelayCommand(() => AddSolidSegment()); AddBrushStopCommand = new RelayCommand(AddBrushStop); + AddGradientSegmentCommand = new RelayCommand(() => AddGradientSegment()); } #endregion @@ -131,9 +138,37 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Adds a new solid segment. /// - private void AddSolidSegment() + private Segment AddSolidSegment() { - MessageBox.Show("SOLID"); + Segment segment = new Segment(); + + if (Job.Segments.Count > 0) + { + segment.SegmentIndex = Job.Segments.Max(x => x.SegmentIndex) + 1; + } + else + { + segment.SegmentIndex = 1; + } + + segment.Length = 10; + + AddBrushStop(segment); + Job.Segments.Add(segment); + + return segment; + } + + /// + /// Adds a new gradient segment. + /// + private Segment AddGradientSegment() + { + var segment = AddSolidSegment(); + segment.BrushStops.Last().Color = Colors.Silver; + AddBrushStop(segment); + segment.BrushStops.Last().Color = Colors.DimGray; + return segment; } #endregion @@ -158,6 +193,10 @@ namespace Tango.PPC.Jobs.ViewModels stop.StopIndex = segment.BrushStops.Max(x => x.StopIndex) + 1; stop.OffsetPercent = 100; } + else + { + stop.StopIndex = 1; + } stop.Segment = segment; stop.Color = Colors.Black; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index c033d878c..4400a7a6e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -346,7 +346,7 @@ SOLID SEGMENT - + diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index c565275ea..bdb308f45 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -80,15 +80,6 @@ namespace Tango.BL.Entities } } - /// - /// Gets the brush stop index within it's segment brush stops collection. - /// - [NotMapped] - public int Index - { - get { return StopIndex; } - } - /// /// Gets a value indicating whether this brush stop is the first one within its segment brush stops. /// @@ -96,7 +87,17 @@ namespace Tango.BL.Entities [JsonIgnore] public bool IsFirst { - get { return StopIndex == 0; } + get + { + if (Segment.BrushStops.Count > 0) + { + return StopIndex == Segment.BrushStops.Min(x => x.StopIndex); + } + else + { + return true; + } + } } /// @@ -106,7 +107,17 @@ namespace Tango.BL.Entities [JsonIgnore] public bool IsLast { - get { return StopIndex == Segment.BrushStops.Count - 1; } + get + { + if (Segment.BrushStops.Count > 0) + { + return StopIndex == Segment.BrushStops.Max(x => x.StopIndex); + } + else + { + return true; + } + } } /// @@ -160,6 +171,7 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(OffsetMeters)); RaisePropertyChanged(nameof(IsFirst)); RaisePropertyChanged(nameof(IsLast)); + RaisePropertyChanged(nameof(IsMiddle)); } /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index a75ce5e2e..f64382456 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -491,7 +491,7 @@ namespace Tango.Integration.Operation foreach (var stop in segment.BrushStops) { JobBrushStop jobStop = new JobBrushStop(); - jobStop.Index = stop.Index; + jobStop.Index = stop.StopIndex; jobStop.OffsetPercent = stop.OffsetPercent; jobStop.OffsetMeters = stop.OffsetMeters; -- cgit v1.3.1 From 6b9ae3d2dfa478c1afdb729e3ad3383aa6bec052 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 26 Jun 2018 16:43:26 +0300 Subject: Implemented adding new job! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 46 ++------------------- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 35 ++++++++++++++++ .../PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml | 2 +- .../Tango.BL/EntitiesExtensions/Job.cs | 38 +++++++++++++++++ .../Tango.BL/EntitiesExtensions/Segment.cs | 31 ++++++++++++++ 7 files changed, 108 insertions(+), 44 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 655618cca..e1e8b307d 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 3ca849535..f22a67230 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 3cb7c2322..7ecc74c10 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -140,23 +140,7 @@ namespace Tango.PPC.Jobs.ViewModels /// private Segment AddSolidSegment() { - Segment segment = new Segment(); - - if (Job.Segments.Count > 0) - { - segment.SegmentIndex = Job.Segments.Max(x => x.SegmentIndex) + 1; - } - else - { - segment.SegmentIndex = 1; - } - - segment.Length = 10; - - AddBrushStop(segment); - Job.Segments.Add(segment); - - return segment; + return Job.AddSolidSegment(); } /// @@ -164,11 +148,7 @@ namespace Tango.PPC.Jobs.ViewModels /// private Segment AddGradientSegment() { - var segment = AddSolidSegment(); - segment.BrushStops.Last().Color = Colors.Silver; - AddBrushStop(segment); - segment.BrushStops.Last().Color = Colors.DimGray; - return segment; + return Job.AddGradientSegment(); } #endregion @@ -181,27 +161,7 @@ namespace Tango.PPC.Jobs.ViewModels /// The segment. private void AddBrushStop(Segment segment) { - BrushStop stop = new BrushStop(); - - if (Job.ColorSpace != null) - { - stop.ColorSpace = Job.ColorSpace; - } - - if (segment.BrushStops.Count > 0) - { - stop.StopIndex = segment.BrushStops.Max(x => x.StopIndex) + 1; - stop.OffsetPercent = 100; - } - else - { - stop.StopIndex = 1; - } - - stop.Segment = segment; - stop.Color = Colors.Black; - - segment.BrushStops.Add(stop); + segment.AddBrushStop(); } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 6ac0ee108..40c6a5dde 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -117,6 +117,11 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand ClearSelectionCommand { get; set; } + /// + /// Gets or sets the add job command. + /// + public RelayCommand AddJobCommand { get; set; } + #endregion #region Constructors @@ -139,6 +144,7 @@ namespace Tango.PPC.Jobs.ViewModels }); ClearSelectionCommand = new RelayCommand(ClearSelection); + AddJobCommand = new RelayCommand(AddNewJob); } #endregion @@ -237,6 +243,35 @@ namespace Tango.PPC.Jobs.ViewModels }; } + /// + /// Adds a new job. + /// + private async void AddNewJob() + { + Job job = new Job(); + job.Name = "untitled"; + job.CreationDate = DateTime.UtcNow; + job.JobStatus = JobStatuses.Draft; + job.JobType = JobTypes.Sewing; + job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault().Guid; + job.MachineGuid = ApplicationManager.Machine.Guid; + job.UserGuid = AuthenticationProvider.CurrentUser.Guid; + job.RmlGuid = Adapter.Rmls.FirstOrDefault().Guid; + job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; + job.SpoolTypeGuid = Adapter.SpoolTypes.FirstOrDefault().Guid; + + job.AddSolidSegment(); + + _jobsContext.Jobs.Add(job); + + await _jobsContext.SaveChangesAsync(); + + Jobs.Add(job); + + RaiseMessage(new JobSelectedMessage() { Job = job }); + await NavigationManager.NavigateTo(nameof(JobView)); + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index 20f3dc761..5105f2f4b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -74,7 +74,7 @@ - + - - - + + + + + + + + + + + - - diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs index f4ad4133d..52f123f7a 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs @@ -231,8 +231,15 @@ namespace Tango.BL.Entities { Job cloned = base.Clone(); + cloned.Name = Name + " - Copy"; cloned.CreationDate = DateTime.UtcNow; cloned.LastRun = null; + cloned.ColorSpace = ColorSpace; + cloned.Customer = Customer; + cloned.LastRun = null; + cloned.Rml = Rml; + cloned.SpoolType = SpoolType; + cloned.WindingMethod = WindingMethod; cloned.Segments = Segments.Select(x => x.Clone(cloned)).ToObservableCollection(); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs index f2d3b3854..8a99524f9 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs @@ -308,13 +308,23 @@ namespace Tango.Touch.Controls { if (ItemsSource is INotifyCollectionChanged) { - + (ItemsSource as INotifyCollectionChanged).CollectionChanged -= LightTouchDataGrid_CollectionChanged; + (ItemsSource as INotifyCollectionChanged).CollectionChanged += LightTouchDataGrid_CollectionChanged; } } ClearSelectedItems(); } + private void LightTouchDataGrid_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.Action == NotifyCollectionChangedAction.Remove) + { + _items_control_rows.UpdateLayout(); + LayoutRows(); + } + } + /// /// Called when the property has changed. /// -- cgit v1.3.1