Exemplo n.º 1
0
 /// <summary>
 /// 创建相机
 /// [注:同品牌同类型下的相机编号不允许相同]
 /// </summary>
 /// <param name="brand"></param>
 /// <param name="ctrllerType"></param>
 /// <param name="camIndex"></param>
 /// <param name="camName"></param>
 public Camera(CtrllerBrand brand, CtrllerType ctrllerType, int camIndex, string camName) : this()
 {
     this.CtrllerCategory = ProCommon.Communal.CtrllerCategory.Camera;
     this.CtrllerBrand    = brand;
     this.Number          = camIndex;
     this.Name            = camName;
     this.Type            = ctrllerType.ToString();
 }
Exemplo n.º 2
0
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex != -1 && this.comboBox2.SelectedIndex != -1)
     {
         CtrllerBrand ctrllerBrand = (CtrllerBrand)Enum.Parse(typeof(CtrllerBrand), (string)comboBox1.Items[comboBox1.SelectedIndex]);
         string       selectedItem = (string)this.comboBox2.SelectedItem;
         if (cameraCtrl.Camera.CameraConfig.SerialNo != selectedItem)
         {
             cameraCtrl.StartCamera(ctrllerBrand, selectedItem);
         }
         this.UpdateUI();
     }
 }
Exemplo n.º 3
0
        public bool StartCamera(CtrllerBrand ctrller, string serialNo)
        {
            this.CloseCamera();
            this.Device = CameraMgr.Inst.Start(ctrller, serialNo);
            if (Device != null)
            {
                //Device.CameraConfig.Number = this.ID;
                InitShow();
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        public CameraDevice Start(CtrllerBrand ctrller, string serialNo)
        {
            CameraDevice cameraDevice = Find(serialNo);

            if (cameraDevice == null)
            {
                Camera camera = new Camera(-1, "");
                camera.CtrllerBrand = ctrller;
                camera.SerialNo     = serialNo;
                camera.Name         = "相机" + serialNo;
                CameraAPIHandle cameraAPIHandle = new CameraAPIHandle(camera);
                cameraDevice = new CameraDevice();
                cameraDevice.SetCameraHandle(cameraAPIHandle);

                cameraDevice.Connect();
                cameraDevices.Add(cameraDevice);
            }

            return(cameraDevice);
        }
Exemplo n.º 5
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex != -1)
     {
         comboBox2.Items.Clear();
         string       device       = (string)comboBox1.Items[comboBox1.SelectedIndex];
         CtrllerBrand ctrllerBrand = (CtrllerBrand)Enum.Parse(typeof(CtrllerBrand), device);
         try
         {
             CameraAPIHandle cameraAPI = new CameraAPIHandle(new Camera(ctrllerBrand, CtrllerType.Camera_AreaScan, 0, ""));
             comboBox2.Items.AddRange(cameraAPI.EnumerateCameraSNList());
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
         if (comboBox2.Items.Contains(cameraCtrl.Camera.CameraConfig.SerialNo))
         {
             this.comboBox2.SelectedItem = cameraCtrl.Camera.CameraConfig.SerialNo;
         }
     }
 }
Exemplo n.º 6
0
 public void InitCam(CameraCtrl camera)
 {
     this.cameraCtrl = camera;
     ctrllerBrand    = this.cameraCtrl.Camera.CameraConfig.CtrllerBrand;
     serialNo        = this.cameraCtrl.Camera.CameraConfig.SerialNo;
 }