2023-04-07 22:10:35 +08:00
|
|
|
|
using Demo.Models;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IcndChip icndChip = new IcndChip();
|
|
|
|
|
icndChip.SetProperty("Code", "1234")
|
|
|
|
|
.SetProperty("Name", "芯片");
|
2023-04-08 08:35:57 +08:00
|
|
|
|
icndChip.Features.ExecuteAll(); // 执行所有功能
|
2023-04-07 22:10:35 +08:00
|
|
|
|
|
|
|
|
|
icndChip.Features
|
|
|
|
|
.DropFeature("场频自适应功能")
|
2023-04-08 08:35:57 +08:00
|
|
|
|
.ExecuteAll();
|
2023-04-07 22:10:35 +08:00
|
|
|
|
|
|
|
|
|
icndChip.Features.Execute("场频自适应功能");
|
|
|
|
|
|
|
|
|
|
icndChip.Formula.Compute(new FormulaExecutionContext() // 计算公式(需要调整)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Console.WriteLine(icndChip.GetProperty<string>("Code"));
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex);
|
|
|
|
|
}
|
|
|
|
|
public class IcndChip : Chip
|
|
|
|
|
{
|
2023-04-08 08:35:57 +08:00
|
|
|
|
public override Guid SignId => Guid.Parse("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4");
|
|
|
|
|
|
2023-04-07 22:10:35 +08:00
|
|
|
|
protected override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
Name = "ICND芯片";
|
|
|
|
|
Features.WithFeature("场频自适应功能", (f, m) =>
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"{m.Name}调用{f.Name}");
|
|
|
|
|
}).WithFeature("其他功能", (f, m) =>
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"{m.Name}调用{f.Name},得到属性[\"Code\"]值{m.GetProperty<string>("Code")}");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|