39 lines
896 B
C#
39 lines
896 B
C#
namespace MyParking.Simulation.Commands;
|
|||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 将一个静态仿真测试方法自动注册为网页按钮。
|
||
|
|
/// 方法签名必须为bool Xxx(SimulationVehicle vehicle)。
|
||
|
|
/// </summary>
|
||
|
|
[AttributeUsage(AttributeTargets.Method)]
|
||
|
|
public sealed class SimulationActionAttribute : Attribute
|
||
|
|
{
|
||
|
|
public SimulationActionAttribute(
|
||
|
|
string key,
|
||
|
|
string displayName,
|
||
|
|
string group,
|
||
|
|
int order = 0)
|
||
|
|
{
|
||
|
|
Key = key;
|
||
|
|
DisplayName = displayName;
|
||
|
|
Group = group;
|
||
|
|
Order = order;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string Key { get; }
|
||
|
|
|
||
|
|
public string DisplayName { get; }
|
||
|
|
|
||
|
|
public string Group { get; }
|
||
|
|
|
||
|
|
public int Order { get; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 网页生成测试按钮所需的命令元数据。
|
||
|
|
/// </summary>
|
||
|
|
public sealed record SimulationActionDescriptor(
|
||
|
|
string Key,
|
||
|
|
string DisplayName,
|
||
|
|
string Group,
|
||
|
|
int Order);
|