private void btnEditConfiguration_Click(object sender, EventArgs e) { TangraConfig.ScopeRecorderConfiguration entry = cbxSavedConfigurations.SelectedItem as TangraConfig.ScopeRecorderConfiguration; VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; Rectangle plateRect = new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); TangraConfig.PersistedPlateConstants pltConst = TangraConfig.Settings.PlateSolve.GetPlateConstants(camera, entry, plateRect); if (entry != null && camera != null) { frmEditConfigName frmNewConfig = new frmEditConfigName(entry, camera, FrameWidth, FrameHeight, pltConst); if (frmNewConfig.ShowDialog(this) == DialogResult.OK) { m_SelectedScopeRecorder = frmNewConfig.Config.Title; if (frmNewConfig.UpdatePlateConstants && frmNewConfig.PltConst != null) { pltConst = frmNewConfig.PltConst; TangraConfig.Settings.PlateSolve.SetPlateConstants(camera, entry, plateRect, pltConst); } ReloadScopeRecorders(); CheckSolvedPlateConstants(camera, entry); } } }
private void btnNewConfig_Click(object sender, EventArgs e) { if (cbxSavedCameras.SelectedItem != null) { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; frmEditConfigName frmNewConfig = new frmEditConfigName(null, camera, FrameWidth, FrameHeight, null); if (frmNewConfig.ShowDialog(this) == DialogResult.OK) { m_SelectedScopeRecorder = frmNewConfig.Config.Title; TangraConfig.ScopeRecorderConfiguration entry = TangraConfig.Settings.PlateSolve.ScopeRecorders.FirstOrDefault(r => r.Title == m_SelectedScopeRecorder); if (frmNewConfig.PltConst != null) { Rectangle plateRect = new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); TangraConfig.PersistedPlateConstants pltConst = new TangraConfig.PersistedPlateConstants(); pltConst.EffectiveFocalLength = frmNewConfig.PltConst.EffectiveFocalLength; pltConst.EffectivePixelWidth = frmNewConfig.PltConst.EffectivePixelWidth; pltConst.EffectivePixelHeight = frmNewConfig.PltConst.EffectivePixelHeight; TangraConfig.Settings.PlateSolve.SetPlateConstants(camera, entry, plateRect, pltConst); TangraConfig.Settings.Save(); } ReloadScopeRecorders(); CheckSolvedPlateConstants(camera, entry); } } else { cbxSavedCameras.Focus(); } }