ChipDemo/Example/Program.cs

38 lines
993 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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