diff --git a/DeedyDesigner/Deedy.Activity/Attribute/CombinePartActionAttribute.cs b/DeedyDesigner/Deedy.Activity/Attribute/CombinePartActionAttribute.cs index bf44ce0..ec6bb3a 100644 --- a/DeedyDesigner/Deedy.Activity/Attribute/CombinePartActionAttribute.cs +++ b/DeedyDesigner/Deedy.Activity/Attribute/CombinePartActionAttribute.cs @@ -8,10 +8,12 @@ using System.Threading.Tasks; namespace Deedy.Activity { [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] - public class CombinePartActionAttribute : Attribute + public class CombinePartActionAttribute : Attribute, IInitialSortable { - public CombinePartActionAttribute(int sort) { this.Sort = sort; } - public int Sort { get; private set; } + public CombinePartActionAttribute(int initSort) { this.InitialSort = initSort; } + + public int InitialSort { get; set; } = 0; + public void Binding(object target, PropertyInfo property) { if (!property.CanRead || !property.CanWrite) throw new ArgumentException("绑定为组装部件的属性必须具备写访问器..."); diff --git a/DeedyDesigner/Deedy.Activity/Attribute/ParmDefineAttribute.cs b/DeedyDesigner/Deedy.Activity/Attribute/ParamDefineAttribute.cs similarity index 67% rename from DeedyDesigner/Deedy.Activity/Attribute/ParmDefineAttribute.cs rename to DeedyDesigner/Deedy.Activity/Attribute/ParamDefineAttribute.cs index 71f263b..29cc4f2 100644 --- a/DeedyDesigner/Deedy.Activity/Attribute/ParmDefineAttribute.cs +++ b/DeedyDesigner/Deedy.Activity/Attribute/ParamDefineAttribute.cs @@ -7,7 +7,8 @@ using System.Threading.Tasks; namespace Deedy.Activity { [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] - public class ParmDefineAttribute : Attribute + public class ParamDefineAttribute : Attribute, IInitialSortable { + public int InitialSort { get; set; } = 0; } } diff --git a/DeedyDesigner/Deedy.Activity/Attribute/ParamGroupAttribute.cs b/DeedyDesigner/Deedy.Activity/Attribute/ParamGroupAttribute.cs new file mode 100644 index 0000000..e98eae3 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Attribute/ParamGroupAttribute.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + public class ParamGroupAttribute : Attribute, IInitialSortable + { + public int InitialSort { get; set; } = 0; + } +} diff --git a/DeedyDesigner/Deedy.Activity/Attribute/ParamValueAttribute.cs b/DeedyDesigner/Deedy.Activity/Attribute/ParamValueAttribute.cs new file mode 100644 index 0000000..c0997e5 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Attribute/ParamValueAttribute.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + /// + /// 用于声明参数的取值 + /// + [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)] + public class ParamValueAttribute : Attribute + { + } +} diff --git a/DeedyDesigner/Deedy.Activity/Collection/ActionTemplateCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/ActionTemplateCollection.cs index 1350482..a86ccb8 100644 --- a/DeedyDesigner/Deedy.Activity/Collection/ActionTemplateCollection.cs +++ b/DeedyDesigner/Deedy.Activity/Collection/ActionTemplateCollection.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,8 @@ using System.Windows; namespace Deedy.Activity { + [Serializable] + [DebuggerDisplay("Count = {Count}")] public class ActionTemplateCollection : ObservableCollection { public ActionTemplateCollection() { } diff --git a/DeedyDesigner/Deedy.Activity/Collection/ElementCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/ElementCollection.cs index 2b37b39..743c8dd 100644 --- a/DeedyDesigner/Deedy.Activity/Collection/ElementCollection.cs +++ b/DeedyDesigner/Deedy.Activity/Collection/ElementCollection.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; @@ -8,6 +9,8 @@ using System.Threading.Tasks; namespace Deedy.Activity { + [Serializable] + [DebuggerDisplay("Count = {Count}")] public class ElementCollection : ObservableCollection { public ElementCollection() : this(false) { } diff --git a/DeedyDesigner/Deedy.Activity/Collection/ExpandoMapping.cs b/DeedyDesigner/Deedy.Activity/Collection/ExpandoMapping.cs index d6d2dd1..21a8fcc 100644 --- a/DeedyDesigner/Deedy.Activity/Collection/ExpandoMapping.cs +++ b/DeedyDesigner/Deedy.Activity/Collection/ExpandoMapping.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,6 +10,8 @@ namespace Deedy.Activity /// /// 用于扩展一个对象的非必要属性 /// + [Serializable] + [DebuggerDisplay("Count = {Count}")] public class ExpandoMapping : Dictionary { } diff --git a/DeedyDesigner/Deedy.Activity/Collection/InitialSortedObservableCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/InitialSortedObservableCollection.cs new file mode 100644 index 0000000..5533148 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Collection/InitialSortedObservableCollection.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + public class InitialSortedObservableCollection : ObservableCollection where T : IInitialSortable + { + protected internal InitialSortedObservableCollection() { } + + public virtual new void Add(T item) => this.Insert(this.CheckInitialSort(item), item); + private int CheckInitialSort(T item) + { + int result = 0; + foreach (var item2 in this) + { + if (item2.InitialSort >= item.InitialSort) + { + break; + } + result++; + } + return result; + } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Collection/LogInfoCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/LogInfoCollection.cs index 25c8e21..2004919 100644 --- a/DeedyDesigner/Deedy.Activity/Collection/LogInfoCollection.cs +++ b/DeedyDesigner/Deedy.Activity/Collection/LogInfoCollection.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Deedy.Activity { + [Serializable] + [DebuggerDisplay("Count = {Count}")] public class LogInfoCollection : ObservableCollection { public LogInfoCollection(int limt = 50) { } diff --git a/DeedyDesigner/Deedy.Activity/Collection/OutputCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/OutputCollection.cs index d621491..473ff81 100644 --- a/DeedyDesigner/Deedy.Activity/Collection/OutputCollection.cs +++ b/DeedyDesigner/Deedy.Activity/Collection/OutputCollection.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Deedy.Activity { + [Serializable] + [DebuggerDisplay("Count = {Count}")] public class OutputCollection : ObservableCollection { } diff --git a/DeedyDesigner/Deedy.Activity/Collection/ParamDefineCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/ParamDefineCollection.cs new file mode 100644 index 0000000..c8962ba --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Collection/ParamDefineCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + [Serializable] + [DebuggerDisplay("「ParamDefineCollection」Count = {Count}", + Target = typeof(ParamDefineCollection), Name = "参数定义集合", Type = nameof(ParamDefineCollection))] + public class ParamDefineCollection : InitialSortedObservableCollection + { + private readonly SortedList _SoredList = new(); + internal ParamDefineCollection() { } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Collection/ParamGroupCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/ParamGroupCollection.cs new file mode 100644 index 0000000..c3d1ee3 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Collection/ParamGroupCollection.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + [Serializable] + [DebuggerDisplay("Count = {Count}")] + public class ParamGroupCollection : InitialSortedObservableCollection + { + internal ParamGroupCollection() { } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Collection/ParamTemplateCollection.cs b/DeedyDesigner/Deedy.Activity/Collection/ParamTemplateCollection.cs new file mode 100644 index 0000000..15f9ec5 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Collection/ParamTemplateCollection.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Deedy.Activity +{ + [Serializable] + [DebuggerDisplay("Count = {Count}")] + public class ParamTemplateCollection : ObservableCollection + { + + } +} diff --git a/DeedyDesigner/Deedy.Activity/Contract/Interface/IInitialSortable.cs b/DeedyDesigner/Deedy.Activity/Contract/Interface/IInitialSortable.cs new file mode 100644 index 0000000..5c037ed --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Contract/Interface/IInitialSortable.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deedy.Activity +{ + /// + /// 可排序对象需要实现的接口 + /// + public interface IInitialSortable + { + /// + /// 初始顺序:这个字段仅仅影响插入集合时的元素顺序,用户在向集合插入数据后仍然可以手动调整顺序 + /// + public int InitialSort { get; } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Selector/ParamTemplateSelector.cs b/DeedyDesigner/Deedy.Activity/Selector/ParamTemplateSelector.cs new file mode 100644 index 0000000..6c91075 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Selector/ParamTemplateSelector.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Deedy.Activity +{ + public class ParamTemplateSelector : DataTemplateSelector + { + public ParamTemplateSelector() + { + } + public override DataTemplate SelectTemplate(object item, DependencyObject container) + { + if (item is ParamDefineAttribute paramDefine) + { + // + } + return base.SelectTemplate(item, container); + } + } +}