添加项目文件。

This commit is contained in:
17860779768
2023-02-23 14:52:43 +08:00
parent 1db01eda58
commit 157613603c
508 changed files with 94132 additions and 0 deletions

View File

@ -0,0 +1,31 @@
using BRS.Common.Interface;
using BRS.Common.Model.Helper;
using System;
using System.Reflection;
namespace BRS.Common.Factory
{
public class UIFactory
{
public static IRunCtrl GetRunCtrl(IDevice device)
{
var attr = device.GetType().GetCustomAttribute<DeviceAttribute>();
if (attr == null)
return null;
var type = FactoryHelper.GetTypeByAtrributeTypeName(attr.TypeCode, EnumHelper.DeviceAttributeType.RunCtrl);
if (type == null)
return null;
IRunCtrl runCtrl = Activator.CreateInstance(type, new object[] { device }) as IRunCtrl;
return runCtrl;
}
public static bool IsDeviceCtrlExisted(string typeName, EnumHelper.DeviceAttributeType ctrlType)
{
var type = FactoryHelper.GetTypeByAtrributeTypeName(typeName, ctrlType);
return type != null;
}
}
}