aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-25 18:03:20 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-25 18:03:20 +0300
commit50eb2f5147af4387f807872ae81dd50dfedbb86e (patch)
treec731631d80bfd0b8a8eeb7a4546f5648b9634a9f /Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs
parentc8890c60c3ee1d9f33606d272fdc45e6f7f5ef3f (diff)
downloadTango-50eb2f5147af4387f807872ae81dd50dfedbb86e.tar.gz
Tango-50eb2f5147af4387f807872ae81dd50dfedbb86e.zip
Working on PPC!!!
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs')
-rw-r--r--Software/Visual_Studio/Tango.Touch/Converters/NumericTextBoxIntegerConverter.cs41
1 files changed, 41 insertions, 0 deletions
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 "";
+ }
+ }
+}