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(); 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; } } }