public int IPrimConnect(ref string result) { var iRet = 0; if (!_core.CreateNewObjects(new SapLocation(_config.ServerName, _config.ResourceIndex), _config.FileName, false)) { return(-1); } return(iRet); }
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"); } }