aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-09-19 14:05:34 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-09-19 14:05:34 +0300
commit48c5d636927f832497e8939a8423ecd1c16892d7 (patch)
tree2eac011bc0aca659131992408d8d9abd61494ed5 /Software/Visual_Studio/Tango.Core/ExtensionMethods
parent1c64e05e5eb5fabe1548c124cbfb8aaab2d1c401 (diff)
downloadTango-48c5d636927f832497e8939a8423ecd1c16892d7.tar.gz
Tango-48c5d636927f832497e8939a8423ecd1c16892d7.zip
Implemented hardware parameter description and range through DB and observables generator.
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
index 3b1c5f271..7107b9ee9 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -95,6 +97,22 @@ public static class IParameterizedExtensions
item.Name = attribute.Name;
}
}
+ else
+ {
+ //Try get description and range attributes
+ DescriptionAttribute desAtt = propertyInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (desAtt != null)
+ {
+ item.Description = desAtt.Description;
+ }
+
+ RangeAttribute rangeAtt = propertyInfo.GetCustomAttribute<RangeAttribute>();
+ if (rangeAtt != null)
+ {
+ item.Minimum = rangeAtt.Minimum;
+ item.Maximum = rangeAtt.Maximum;
+ }
+ }
if (mode == ParameterItemMode.Event)
{