public ICImagingCamera(ICImagingControl camera, int index)
        {
            this.camera      = camera;
            this.cameraIndex = index;

            VCDProp = VCDSimpleModule.GetSimplePropertyContainer(camera.VCDPropertyItems);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Connect to camera. Will fail if configuration file referred to invalid or disconnected camera
        /// </summary>
        /// <returns>True if initialization is successful</returns>
        public bool Initialize(ICImagingControl ic)
        {
            this.ic = ic;
            try
            {
                this.ic.LoadDeviceStateFromFile(this.configFile, true);
                this.Available = true;
            }
            catch (TIS.Imaging.ICException err)
            {
                System.Windows.Forms.MessageBox.Show("Error occurred while initializing WFOV camera. WFOV will be unavailable.\n\n" + err.ToString());
                Logger.Out(err.ToString());
                this.Available = false;
                return(false);
            }
            catch (System.IO.IOException err)
            {
                System.Windows.Forms.MessageBox.Show("WFOV configuration file missing or invalid.");
                Logger.Out(err.ToString());
                this.Available = false;
                return(false);
            }

            if (this.ic.DeviceValid)
            {
                this.ic.LivePrepare();
                this.VCDProp        = VCDSimpleModule.GetSimplePropertyContainer(this.ic.VCDPropertyItems);
                this.ic.DeviceLost += this.handleDisconnect;
                return(true);
            }
            System.Windows.Forms.MessageBox.Show("Failed to initialize WFOV camera");
            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化相机
        /// </summary>
        /// <param name="deviceStateFile">相机参数储存文件路径</param>
        /// <returns>是否成功打开相机</returns>
        public bool InitCam(string deviceStateFile)
        {
            try
            {
                LoadDeviceStateFromFile(deviceStateFile, true);
            }
            catch
            {
                ShowDeviceSettingsDialog();
            }

            if (!this.DeviceValid)
            {
                return(this.DeviceValid);
            }

            this._vcdProp = VCDSimpleModule.GetSimplePropertyContainer(this.VCDPropertyItems);
            //软触发
            this._softTrigger =
                (VCDButtonProperty)this.VCDPropertyItems.FindInterface(VCDIDs.VCDID_TriggerMode, VCDIDs.VCDElement_SoftwareTrigger, VCDIDs.VCDInterface_Button);
            this.GainAuto     = false;
            this.ExposureAuto = false;
            SaveDeviceStateToFile(deviceStateFile);

            return(this.DeviceValid);
        }