aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-10-25 13:35:52 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-10-25 13:35:52 +0300
commitf681b137c727f7dcdb7d3f5765af8b5b3048c2d9 (patch)
treee9811c974c90a9d3bc3fefab891e6f9b7271ed8e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters
parent57ad0a219784843d565524235122dbd1ad6c37ae (diff)
downloadTango-f681b137c727f7dcdb7d3f5765af8b5b3048c2d9.tar.gz
Tango-f681b137c727f7dcdb7d3f5765af8b5b3048c2d9.zip
Implemented Job Outline.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs
new file mode 100644
index 000000000..09e7b527a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class ObjectToPropertiesConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ var properties = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => (!x.PropertyType.IsClass && !typeof(IEnumerable).IsAssignableFrom(x.PropertyType)) || x.PropertyType == typeof(String)).ToList();
+ return properties.Select(x => new { x.Name, Value = x.GetValue(value) });
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}