using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace Deedy.Activity { public abstract class BasalAction : IActionElement { 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 IElement? ParentElement { get; protected internal set; } public IActionViewer? ActionViewer { get; protected internal set; } public IElement RootElement => (this.ParentElement == null) ? this : this.ParentElement.RootElement; public event PropertyChangedEventHandler? PropertyChanged; /// /// 发送属性变更通知 /// /// 发生变更的属性 protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); /// /// 读取一个字段的值 /// /// 值的类型,可以通过参数进行自动判定 /// 字段的引用【注意:此参数通过引用传递】 /// 属性名称;如果在属性的读取访问器中调用可以自动注入 /// 字段中的值 protected virtual T GetField(ref T field, [CallerMemberName] string? propertyName = null) { return field; } /// /// 检查新值是否与原值相等,如果不相等便赋值并发出通知 /// /// 值的类型,可以通过参数进行自动判定 /// 字段的引用【注意:此参数通过引用传递】 /// 字段的新值 /// 要进行变更通知的属性名称;如果在属性的设置访问器中调用可以自动注入 /// 值是否有变更 protected virtual bool SetField(ref T field, T value, [CallerMemberName] string? propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } public void InsertToFore(IElement element) { throw new NotImplementedException(); } public void InsertAtRear(IElement element) { throw new NotImplementedException(); } public void SwapIndex(IElement element) { throw new NotImplementedException(); } public void ReadyToWorking(IElement? element = null, Output? output = null) { throw new NotImplementedException(); } } }