diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-01-23 14:34:55 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-01-23 14:34:55 +0200 |
| commit | 60a2692fd4acadfdf8724bb198e38a2689a866fd (patch) | |
| tree | e0924aa7d75c61875419dca7c31b338addd8661e /Software/Visual_Studio/Tango.Core | |
| parent | 73433f297a3361511ba8ff99e2ff852e376987c5 (diff) | |
| download | Tango-60a2692fd4acadfdf8724bb198e38a2689a866fd.tar.gz Tango-60a2692fd4acadfdf8724bb198e38a2689a866fd.zip | |
Added new staple spun process parameters to database, BL and PMR.
Implemented process params index via db.
Added new process params in MS.
Added JOB_RUN => Upload time, Heating Time, IsGradient...
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
3 files changed, 34 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs b/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs new file mode 100644 index 000000000..c9a4fbc9d --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Core.CustomAttributes +{ + [AttributeUsage(AttributeTargets.Property)] + public class PropertyIndexAttribute : Attribute + { + public int Index { get; set; } + + public PropertyIndexAttribute() + { + Index = 0; + } + + public PropertyIndexAttribute(int index) : this() + { + Index = index; + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs index 4850ccc25..c0490af8e 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs @@ -54,10 +54,11 @@ public static class IParameterizedExtensions { var paramAtt = prop.GetCustomAttributes(typeof(ParameterItemAttribute), false).Cast<ParameterItemAttribute>().FirstOrDefault(); var ignore = prop.GetCustomAttributes(typeof(ParameterIgnoreAttribute), false).Cast<ParameterIgnoreAttribute>().FirstOrDefault(); + var indexAttr = prop.GetCustomAttributes(typeof(PropertyIndexAttribute), false).Cast<PropertyIndexAttribute>().FirstOrDefault(); if (ignore == null && !properties.Exists(x => x.Name == prop.Name)) { - var item = instance.CreateParameterItem(prop, paramAtt, index++, mode); + var item = instance.CreateParameterItem(prop, paramAtt,indexAttr != null ? indexAttr.Index : index++, mode); ps.Add(item); properties.Add(prop); } @@ -65,7 +66,7 @@ public static class IParameterizedExtensions } } - return ps; + return ps.OrderBy(x => x.Index).ToObservableCollection(); } /// <summary> @@ -119,6 +120,12 @@ public static class IParameterizedExtensions { item.StringFormat = formatAtt.Format; } + + PropertyIndexAttribute indexAtt = propertyInfo.GetCustomAttribute<PropertyIndexAttribute>(); + if (indexAtt != null) + { + item.Index = indexAtt.Index; + } } if (mode == ParameterItemMode.Event) diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 1dc51c2cf..06c6e5a22 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -89,6 +89,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Components\CmdCommand.cs" /> + <Compile Include="CustomAttributes\PropertyIndexAttribute.cs" /> <Compile Include="CustomAttributes\StringFormatAttribute.cs" /> <Compile Include="ExtensionMethods\ByteArrayExtensions.cs" /> <Compile Include="IO\KnownFolders.cs" /> |
