38 lines
993 B
C#
38 lines
993 B
C#
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芯片";
|
||
}
|
||
}
|
||
|