79 lines
3.2 KiB
C#
79 lines
3.2 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// 发送属性变更通知
|
|
/// </summary>
|
|
/// <param name="propertyName">发生变更的属性</param>
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
/// <summary>
|
|
/// 读取一个字段的值
|
|
/// </summary>
|
|
/// <typeparam name="T">值的类型,可以通过参数进行自动判定</typeparam>
|
|
/// <param name="field">字段的引用【注意:此参数通过引用传递】</param>
|
|
/// <param name="propertyName">属性名称;如果在属性的读取访问器中调用可以自动注入</param>
|
|
/// <returns>字段中的值</returns>
|
|
protected virtual T GetField<T>(ref T field, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
return field;
|
|
}
|
|
/// <summary>
|
|
/// 检查新值是否与原值相等,如果不相等便赋值并发出通知
|
|
/// </summary>
|
|
/// <typeparam name="T">值的类型,可以通过参数进行自动判定</typeparam>
|
|
/// <param name="field">字段的引用【注意:此参数通过引用传递】</param>
|
|
/// <param name="value">字段的新值</param>
|
|
/// <param name="propertyName">要进行变更通知的属性名称;如果在属性的设置访问器中调用可以自动注入</param>
|
|
/// <returns>值是否有变更</returns>
|
|
protected virtual bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
if (EqualityComparer<T>.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();
|
|
}
|
|
}
|
|
}
|