/// <summary> /// 打开相机 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_opencamera_Click(object sender, EventArgs e) { AcqConfigDlg acConfigDlg = new AcqConfigDlg(null, "", AcqConfigDlg.ServerCategory.ServerAcqDevice); if (acConfigDlg.ShowDialog() == DialogResult.OK) { if (!CreateNewObjects(acConfigDlg, false)) { this.Close(); } } else { MessageBox.Show("No GigE-Vision cameras found or selected"); this.Close(); } }
private void button_LoadConfig_Click(object sender, EventArgs e) { _dalsaCore.DestroyObjects(); var acConfigDlg = new AcqConfigDlg(null, "", AcqConfigDlg.ServerCategory.ServerAcq); if (acConfigDlg.ShowDialog() == DialogResult.OK) { var onlineSave = _dalsaCore.Online; _dalsaCore.Online = true; var serverLocationSave = _dalsaCore.Location; _dalsaCore.DestroyObjects(); _dalsaConfig.FileName = acConfigDlg.m_ConfigFile; _dalsaConfig.ResourceIndex = acConfigDlg.m_ResourceIndex; _dalsaConfig.ServerName = acConfigDlg.m_ServerName; if (!_dalsaCore.CreateNewObjects(acConfigDlg.ServerLocation, _dalsaConfig.FileName, false)) { MessageBox.Show("New objects creation has failed. Restoring original object "); _dalsaCore.Location = serverLocationSave; _dalsaCore.Online = onlineSave; if (!_dalsaCore.CreateNewObjects(null, "", true)) { MessageBox.Show("Original object creation has failed. Closing application "); Application.Exit(); } } _dalsaConfig.Width = _dalsaCore.m_View.Buffer.Width; _dalsaConfig.Height = _dalsaCore.m_View.Buffer.Height; _dalsaCore.ObjSize = _dalsaConfig.Width * _dalsaConfig.Height; textBoxWidth.Text = _dalsaConfig.Width.ToString(); textBoxHeight.Text = _dalsaConfig.Height.ToString(); } else { MessageBox.Show("No Modification in Acquisition"); } }