public CalibrationWindow() { log.Info("Calib constructor"); InitializeComponent(); string vendor = ConfigurationManager.AppSettings["cameraVendor"]; imgAcquirer = ImageAcquirerFactory.CreateImageAcquirer(vendor); string stest = ConfigurationManager.AppSettings["testOnly"]; bUseTestImage = bool.Parse(stest); testImagePath = Helper.GetCalibPath() + Others.covert2Short(GlobalVals.sCalibFile) + ".jpg"; if (bUseTestImage) { if(!File.Exists(testImagePath)) throw new FileNotFoundException(); } if(GlobalVals.onPosID) btnNext.Content = "完成"; log.Info("init calibration"); SetStage(CameraStage.First); InitControls(); this.Loaded += new RoutedEventHandler(CalibrationWindow_Loaded); this.Closing += new System.ComponentModel.CancelEventHandler(CalibrationWindow_Closing); }
public MeasureWindow() { InitializeComponent(); this.AdjustSize(); string vendorName = ConfigurationManager.AppSettings["cameraVendor"]; imgAcquirer = ImageAcquirerFactory.CreateImageAcquirer(vendorName); this.Loaded += new RoutedEventHandler(MeasureWindow_Loaded); string stest = ConfigurationManager.AppSettings["testOnly"]; testImagePath = Helper.GetCalibPath() + Others.covert2Short(GlobalVals.sCalibFile) + ".jpg"; bUseTestImage = bool.Parse(stest); imgAcquirer.onFinished += ImgAcquirer_onFinished; }
private void button1_Click(object sender, EventArgs e) { IniConfigSetting.Default.SetConfigParamValue("TEST", "SelectIndex", this.comboBox1.SelectedIndex.ToString()); this.textBox1.Text = ""; if (acq != null) { acq.Dispose(); acq = null; } acq = mgr.GetAdapter(this.comboBox1.Text);//"WebCam"); acq.OnAcquired -= acq_OnAcquired; acq.OnError -= acq_OnError; acq.OnAcquired += acq_OnAcquired; acq.OnError += acq_OnError; acq.Initialize(null); acq.Acquire(); }