From ca96477441518c8300474a317e34cb5e7e1550fc Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 9 Jul 2018 12:44:59 +0300 Subject: PPC Performance improvements. --- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs') diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 50c478acc..c45701e99 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -25,6 +25,13 @@ namespace Tango.Touch.Controls Regex regex_integer = new Regex(@"^[0-9]*(?:[0-9]*)?$"); Regex regex_double = new Regex(@"^[0-9]*(?:\.[0-9]*)?$"); + public static readonly RoutedEvent ValueChangedEvent = EventManager.RegisterRoutedEvent("ValueChanged", RoutingStrategy.Bubble, typeof(DoubleValueChangedEventHandler), typeof(TouchNumericTextBox)); + public event DoubleValueChangedEventHandler ValueChanged + { + add { AddHandler(ValueChangedEvent, value); } + remove { RemoveHandler(ValueChangedEvent, value); } + } + public double Value { get { return (double)GetValue(ValueProperty); } @@ -167,17 +174,16 @@ namespace Tango.Touch.Controls { if (_text_box != null && !_prevent_text_change) { - _text_box.Text = Value.ToString(); - if (StringFormat != null) { - _text_block.Text = Value.ToString(StringFormat); _text_box.Text = Value.ToString(StringFormat); } else { - _text_block.Text = Value.ToString(); + _text_box.Text = Value.ToString(); } + + _text_block.Text = _text_box.Text; } if (Value != _lastValue) @@ -190,6 +196,9 @@ namespace Tango.Touch.Controls } _lastValue = Value; + + DoubleValueChangedEventArgs args = new DoubleValueChangedEventArgs(ValueChangedEvent, this, Value); + RaiseEvent(args); } } -- cgit v1.3.1