Beispiel #1
0
        /// <exception cref="T:ASCOM.DriverException">Must throw an exception if the call was not successful</exception>
        public void SetupDialog()
        {
            string version = "1.0";

            try
            {
                version = (this as IVideo).DriverVersion;
            }
            catch
            { }

            using (var setupDlg = new frmSetupDialog(settings, version))
            {
                Form ownerForm = Application.OpenForms
                                 .Cast <Form>()
                                 .FirstOrDefault(x => x != null && x.GetType().FullName == "ASCOM.Utilities.ChooserForm");

                if (ownerForm == null)
                {
                    ownerForm = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x != null && x.Owner == null);
                }

                setupDlg.StartPosition = FormStartPosition.CenterParent;

                if (setupDlg.ShowDialog(ownerForm) == DialogResult.OK)
                {
                    settings.Save();

                    camera.ReloadSettings();

                    return;
                }
                settings.Reload();
            }
        }
        public DialogResult SaveSettings()
        {
            if (rbCompressionUnsupported.Checked && cbxOtherCodecs.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a video codec to use.", "ASCOM Video Capture");
                cbxOtherCodecs.Focus();
                return(DialogResult.Cancel);
            }

            if (SaveSettingsInternal())
            {
                settings.Save();
                return(DialogResult.OK);
            }

            return(DialogResult.None);
        }