调整继承结构与基类重命名
This commit is contained in:
		@@ -92,13 +92,13 @@ namespace Deedy.Activity
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 动作节点
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public IDeedyAction DeedyAction
 | 
			
		||||
        public IActionElement DeedyAction
 | 
			
		||||
        {
 | 
			
		||||
            get { return (IDeedyAction)GetValue(DeedyActionProperty); }
 | 
			
		||||
            get { return (IActionElement)GetValue(DeedyActionProperty); }
 | 
			
		||||
            set { SetValue(DeedyActionProperty, value); }
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty DeedyActionProperty =
 | 
			
		||||
            DependencyProperty.Register("DeedyAction", typeof(IDeedyAction), typeof(ActionViewer), new PropertyMetadata(null,
 | 
			
		||||
            DependencyProperty.Register("DeedyAction", typeof(IActionElement), typeof(ActionViewer), new PropertyMetadata(null,
 | 
			
		||||
                (d, e) => (d as ActionViewer)?.DeedyAction_PropertyChangedCallback(e)));
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处理「DeedyActionViewer.DeedyAction」属性变更
 | 
			
		||||
@@ -107,7 +107,7 @@ namespace Deedy.Activity
 | 
			
		||||
        {
 | 
			
		||||
            //
 | 
			
		||||
        }
 | 
			
		||||
        public void ReadyToWorking(Runtime? runtime)
 | 
			
		||||
        public void ReadyToWorking(IElementActivity? element = null, Output? output = null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,18 +8,18 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class DeedyAction : IDeedyAction
 | 
			
		||||
    public abstract class BasalAction : IActionElement
 | 
			
		||||
    {
 | 
			
		||||
        protected internal DeedyAction() { }
 | 
			
		||||
        protected internal BasalAction() { }
 | 
			
		||||
        public string DEClass { get; protected internal set; } = "";
 | 
			
		||||
        public string DETitle { get; set; } = "";
 | 
			
		||||
        public string DERemark { get; set; } = "";
 | 
			
		||||
        public string DEIdentify { get; set; } = "";
 | 
			
		||||
        public int DepthLevel { get; protected internal set; } = 0;
 | 
			
		||||
        public IDeedyElement? ParentElement { get; protected internal set; }
 | 
			
		||||
        public IElementActivity? ParentElement { get; protected internal set; }
 | 
			
		||||
        public IActionViewer? ActionViewer { get; protected internal set; }
 | 
			
		||||
 | 
			
		||||
        public IDeedyElement RootElement => (this.ParentElement == null) ? this : this.ParentElement.RootElement;
 | 
			
		||||
        public IElementActivity RootElement => (this.ParentElement == null) ? this : this.ParentElement.RootElement;
 | 
			
		||||
 | 
			
		||||
        public event PropertyChangedEventHandler? PropertyChanged;
 | 
			
		||||
 | 
			
		||||
@@ -55,22 +55,22 @@ namespace Deedy.Activity
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InsertToFore(IDeedyElement deedyElement)
 | 
			
		||||
        public void InsertToFore(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InsertAtRear(IDeedyElement deedyElement)
 | 
			
		||||
        public void InsertAtRear(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SwapIndex(IDeedyElement deedyElement)
 | 
			
		||||
        public void SwapIndex(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ReadyToWorking(IDeedyElement? parent = null)
 | 
			
		||||
        public void ReadyToWorking(IElementActivity? element = null, Output? output = null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public class DeedyElementCollection : ObservableCollection<IDeedyElement>
 | 
			
		||||
    public class DeedyElementCollection : ObservableCollection<IElementActivity>
 | 
			
		||||
    {
 | 
			
		||||
        public DeedyElementCollection() : this(false) { }
 | 
			
		||||
        public DeedyElementCollection(bool needDistinct = false)
 | 
			
		||||
@@ -16,15 +16,15 @@ namespace Deedy.Activity
 | 
			
		||||
            this._needDistinct = needDistinct;
 | 
			
		||||
        }
 | 
			
		||||
        private bool _needDistinct = false;
 | 
			
		||||
        public void AddRange(params IDeedyElement[] elements)
 | 
			
		||||
        public void AddRange(params IElementActivity[] elements)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (var element in elements) this.Add(element);
 | 
			
		||||
        }
 | 
			
		||||
        public void AddRange([AllowNull] IEnumerable<IDeedyElement> elements)
 | 
			
		||||
        public void AddRange([AllowNull] IEnumerable<IElementActivity> elements)
 | 
			
		||||
        {
 | 
			
		||||
            if (elements != null) foreach (var element in elements) this.Add(element);
 | 
			
		||||
        }
 | 
			
		||||
        public new void Add([AllowNull] IDeedyElement element)
 | 
			
		||||
        public new void Add([AllowNull] IElementActivity element)
 | 
			
		||||
        {
 | 
			
		||||
            if (element == null) return;
 | 
			
		||||
            if (this._needDistinct)
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface ICombinedElement : IDeedyElement
 | 
			
		||||
    public interface ICombinedElement : IElementActivity
 | 
			
		||||
    {
 | 
			
		||||
        public DeedyElementCollection Elements { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IContainerElement : ICombinedElement
 | 
			
		||||
    {
 | 
			
		||||
        public void Append(IDeedyElement deedyElement);
 | 
			
		||||
        public void Remove(IDeedyElement deedyElement);
 | 
			
		||||
        public void Append(IElementActivity deedyElement);
 | 
			
		||||
        public void Remove(IElementActivity deedyElement);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class ExecAction : DeedyAction
 | 
			
		||||
    public abstract class ExecAction : BasalAction
 | 
			
		||||
    {
 | 
			
		||||
        protected internal ExecAction() { }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class FlowAction : DeedyAction
 | 
			
		||||
    public abstract class FlowAction : BasalAction
 | 
			
		||||
    {
 | 
			
		||||
        protected internal FlowAction() { }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,10 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class CombinedNode : FlowAction
 | 
			
		||||
    public abstract class CombinedNode : FlowAction, ICombinedElement
 | 
			
		||||
    {
 | 
			
		||||
        public CombinedNode() { }
 | 
			
		||||
 | 
			
		||||
        public DeedyElementCollection Elements { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,20 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class ContainerBlock : FlowAction
 | 
			
		||||
    public abstract class ContainerBlock : FlowAction, IContainerElement
 | 
			
		||||
    {
 | 
			
		||||
        public ContainerBlock() { }
 | 
			
		||||
 | 
			
		||||
        public DeedyElementCollection Elements { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 | 
			
		||||
 | 
			
		||||
        public void Append(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Remove(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class FuncAction : DeedyAction
 | 
			
		||||
    public abstract class FuncAction : BasalAction
 | 
			
		||||
    {
 | 
			
		||||
        protected internal FuncAction() { }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,10 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class CombinedFunction : FuncAction
 | 
			
		||||
    public abstract class CombinedFunction : FuncAction, ICombinedElement
 | 
			
		||||
    {
 | 
			
		||||
        public CombinedFunction() { }
 | 
			
		||||
 | 
			
		||||
        public DeedyElementCollection Elements { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,20 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public abstract class ContainerFunction : FuncAction
 | 
			
		||||
    public abstract class ContainerFunction : FuncAction, IContainerElement
 | 
			
		||||
    {
 | 
			
		||||
        public ContainerFunction() { }
 | 
			
		||||
 | 
			
		||||
        public DeedyElementCollection Elements { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 | 
			
		||||
 | 
			
		||||
        public void Append(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Remove(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,9 +15,9 @@ namespace Deedy.Activity
 | 
			
		||||
        public string DERemark { get; set; } = "";
 | 
			
		||||
        public string DEIdentify { get; set; } = "";
 | 
			
		||||
        public int DepthLevel { get; protected internal set; } = 0;
 | 
			
		||||
        public IDeedyElement? ParentElement { get; protected internal set; }
 | 
			
		||||
        public IElementActivity? ParentElement { get; protected internal set; }
 | 
			
		||||
 | 
			
		||||
        public IDeedyElement RootElement => (this.ParentElement == null) ? this : this.ParentElement.RootElement;
 | 
			
		||||
        public IElementActivity RootElement => (this.ParentElement == null) ? this : this.ParentElement.RootElement;
 | 
			
		||||
 | 
			
		||||
        public DeedyElementCollection Elements { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 | 
			
		||||
 | 
			
		||||
@@ -57,37 +57,37 @@ namespace Deedy.Activity
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Append(IDeedyElement deedyElement)
 | 
			
		||||
        public void Append(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Remove(IDeedyElement deedyElement)
 | 
			
		||||
        public void Remove(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InsertToFore(IDeedyElement deedyElement)
 | 
			
		||||
        public void InsertToFore(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InsertAtRear(IDeedyElement deedyElement)
 | 
			
		||||
        public void InsertAtRear(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SwapIndex(IDeedyElement element1, IDeedyElement element2)
 | 
			
		||||
        public void SwapIndex(IElementActivity element1, IElementActivity element2)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SwapIndex(IDeedyElement deedyElement)
 | 
			
		||||
        public void SwapIndex(IElementActivity deedyElement)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ReadyToWorking(IDeedyElement? parent = null)
 | 
			
		||||
        public void ReadyToWorking(IElementActivity? element = null, Output? output = null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IDeedyAction : IDeedyElement
 | 
			
		||||
    public interface IActionElement : IElementActivity
 | 
			
		||||
    {
 | 
			
		||||
        public IActionViewer? ActionViewer { get; }
 | 
			
		||||
    }
 | 
			
		||||
@@ -9,11 +9,9 @@ using System.Windows;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IActionViewer : INotifyPropertyChanged
 | 
			
		||||
    public interface IActionViewer : IDeedyActivity, INotifyPropertyChanged
 | 
			
		||||
    {
 | 
			
		||||
        [AllowNull]
 | 
			
		||||
        public IDeedyAction DeedyAction { get; set; }
 | 
			
		||||
        public void ReadyToWorking(Runtime? runtime);
 | 
			
		||||
        
 | 
			
		||||
        public IActionElement DeedyAction { get; set; }        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								DeedyDesigner/Deedy.Activity/IDeedyActivity.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								DeedyDesigner/Deedy.Activity/IDeedyActivity.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IDeedyActivity
 | 
			
		||||
    {
 | 
			
		||||
        public void ReadyToWorking(IElementActivity? element = null, Output? output = null);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -10,23 +10,23 @@ using System.Windows.Markup;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IDeedyElement : INotifyPropertyChanged
 | 
			
		||||
    public interface IElementActivity : IDeedyActivity, INotifyPropertyChanged
 | 
			
		||||
    {
 | 
			
		||||
        public string DEClass { get; }
 | 
			
		||||
        public string DETitle { get; set; }
 | 
			
		||||
        public string DERemark { get; set; }
 | 
			
		||||
        public string DEIdentify { get; set; }
 | 
			
		||||
        public int DepthLevel { get; }
 | 
			
		||||
        public IDeedyElement? ParentElement { get; }
 | 
			
		||||
        public IDeedyElement RootElement { get; }
 | 
			
		||||
        public void InsertToFore(IDeedyElement deedyElement);
 | 
			
		||||
        public void InsertAtRear(IDeedyElement deedyElement);
 | 
			
		||||
        public void SwapIndex(IDeedyElement deedyElement);
 | 
			
		||||
        public IElementActivity? ParentElement { get; }
 | 
			
		||||
        public IElementActivity RootElement { get; }
 | 
			
		||||
        public void InsertToFore(IElementActivity deedyElement);
 | 
			
		||||
        public void InsertAtRear(IElementActivity deedyElement);
 | 
			
		||||
        public void SwapIndex(IElementActivity deedyElement);
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 将当前节点链接到一个节点上
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="element">要链接到的节点</param>
 | 
			
		||||
        public virtual void LinkTo([AllowNull] IDeedyElement element)
 | 
			
		||||
        public virtual void LinkTo([AllowNull] IElementActivity element)
 | 
			
		||||
        {
 | 
			
		||||
            if (element == null)
 | 
			
		||||
            {
 | 
			
		||||
@@ -58,26 +58,26 @@ namespace Deedy.Activity
 | 
			
		||||
        public virtual void Unlink()
 | 
			
		||||
        {
 | 
			
		||||
            (this.ParentElement as IContainerElement)?.Remove(this);
 | 
			
		||||
            this.SetNamedPropertyValue<IDeedyElement?>(nameof(ParentElement), null);
 | 
			
		||||
            this.SetNamedPropertyValue<IElementActivity?>(nameof(ParentElement), null);
 | 
			
		||||
            this.SetNamedPropertyValue(nameof(DepthLevel), 0);
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 构建结构树,设置层级:并且完成参数映射的刷新
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="parent"></param>
 | 
			
		||||
        public void ReadyToWorking(IDeedyElement? parent = null)
 | 
			
		||||
        public new void ReadyToWorking(IElementActivity? element = null, Output? output = null)
 | 
			
		||||
        {
 | 
			
		||||
            //TODO:刷新参数映射
 | 
			
		||||
            this.LinkTo(parent);
 | 
			
		||||
            this.LinkTo(element);
 | 
			
		||||
            if (this is IContainerElement container)
 | 
			
		||||
                foreach (IDeedyElement element in container.Elements)
 | 
			
		||||
                    element.ReadyToWorking(this);
 | 
			
		||||
                foreach (IElementActivity subElement in container.Elements)
 | 
			
		||||
                    subElement.ReadyToWorking(this);
 | 
			
		||||
        }
 | 
			
		||||
        public virtual IDeedyElement? Clone()
 | 
			
		||||
        public virtual IElementActivity? Clone()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                return XamlReader.Parse(XamlWriter.Save(this)) as IDeedyElement;
 | 
			
		||||
                return XamlReader.Parse(XamlWriter.Save(this)) as IElementActivity;
 | 
			
		||||
            }
 | 
			
		||||
            catch { return null; }
 | 
			
		||||
        }
 | 
			
		||||
@@ -92,13 +92,13 @@ namespace Deedy.Activity
 | 
			
		||||
            catch { document = string.Empty; }
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
        public static virtual bool TryDecode(string document, out IDeedyElement? element)
 | 
			
		||||
        public static virtual bool TryDecode(string document, out IElementActivity? element)
 | 
			
		||||
        {
 | 
			
		||||
            IDeedyElement? instance = null;
 | 
			
		||||
            IElementActivity? instance = null;
 | 
			
		||||
            bool result = false;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                instance = XamlReader.Parse(document) as IDeedyElement;
 | 
			
		||||
                instance = XamlReader.Parse(document) as IElementActivity;
 | 
			
		||||
                result = instance != null;
 | 
			
		||||
            }
 | 
			
		||||
            catch { }
 | 
			
		||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Deedy.Activity
 | 
			
		||||
{
 | 
			
		||||
    public interface IDeedyVisual : IDeedyElement
 | 
			
		||||
    public interface IVisualElement : IElementActivity
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user