/// <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(); }
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(); } }
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); }
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); }
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; } } }
public void InitCam(CameraCtrl camera) { this.cameraCtrl = camera; ctrllerBrand = this.cameraCtrl.Camera.CameraConfig.CtrllerBrand; serialNo = this.cameraCtrl.Camera.CameraConfig.SerialNo; }