Exemple #1
0
 public static ICameraDevice CreateCamera()
 {
     if (camera == null)
     {
         String CameraType = Tool.getAppSetting("CameraType");
         Type   type       = Type.GetType(CameraType);
         object obj        = null;
         try
         {
             obj = Activator.CreateInstance(type);
         }catch (Exception ex)
         {
             Tool.AppLogFatal("创建相机实例失败!", ex);
         }
         if (obj != null && obj is ICameraDevice)
         {
             camera = obj as ICameraDevice;
         }
     }
     return(camera);
 }
Exemple #2
0
        public static IStep CreateStep(String TypeStr)
        {
            if (StepMap.ContainsKey(TypeStr))
            {
                return(StepMap[TypeStr]);
            }
            Type   type = Type.GetType(TypeStr);
            object obj  = null;

            try
            {
                obj = Activator.CreateInstance(type);
            }
            catch (Exception ex)
            {
                Tool.AppLogFatal("加载实验步骤失败", ex);
            }
            if (obj != null && obj is IStep)
            {
                StepMap.Add(TypeStr, (IStep)obj);
                return((IStep)obj);
            }
            return(null);
        }