ChipDemo/Example/Program.cs

38 lines
993 B
C#
Raw Permalink Normal View History

2023-04-09 16:22:54 +08:00
using Demo.Features;
using Demo.Models;
2023-04-07 22:10:35 +08:00
try
{
2023-04-09 16:22:54 +08:00
FeatureContainer.Instance
.RegisterWrapper((m, f) => new FeatureWrapper(m, f)) // 注册功能调用包装器可以不写默认是FeatureWrapper
.RegisterFeature("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4", new DefaultFeature("场频自适应功能", // 注册功能
(feature, metadata) =>
{
Console.WriteLine("调用场频自适应功能");
}));
2023-04-07 22:10:35 +08:00
IcndChip icndChip = new IcndChip();
icndChip.SetProperty("Code", "1234")
.SetProperty("Name", "芯片");
2023-04-09 16:22:54 +08:00
2023-04-07 22:10:35 +08:00
icndChip.Features.Execute("场频自适应功能");
2023-04-09 16:22:54 +08:00
icndChip.Features.Execute("测试");
2023-04-07 22:10:35 +08:00
Console.WriteLine(icndChip.GetProperty<string>("Code"));
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
public class IcndChip : Chip
{
2023-04-09 16:22:54 +08:00
public override string SignId => "F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4";
2023-04-08 08:35:57 +08:00
2023-04-07 22:10:35 +08:00
protected override void Initialize()
{
Name = "ICND芯片";
}
}