예제 #1
0
        /// <exception cref="T:ASCOM.DriverException">Must throw an exception if the call was not successful</exception>
        public void SetupDialog()
        {
            using (var setupDlg = new frmSetupDialog())
            {
                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)
                {
                    Properties.Settings.Default.Save();

                    camera.ReloadSimulatorSettings();
                    return;
                }
                Properties.Settings.Default.Reload();
            }
        }
예제 #2
0
        private static void ShowSetup()
        {
            frmSetupDialog SetupDialog = new frmSetupDialog();

            SetupDialog.Slots             = SimulatedHardware.Slots;
            SetupDialog.Time              = SimulatedHardware.Interval;
            SetupDialog.Names             = SimulatedHardware.FullFilterNames;
            SetupDialog.Offsets           = SimulatedHardware.FullFocusOffsets;
            SetupDialog.Colours           = SimulatedHardware.FullFilterColours;
            SetupDialog.ImplementsNames   = SimulatedHardware.ImplementsNames;
            SetupDialog.ImplementsOffsets = SimulatedHardware.ImplementsOffsets;
            SetupDialog.PreemptsMoves     = SimulatedHardware.PreemptMoves;

            //SetupDialog.TopMost = true;   // The ASCOM chooser dialog sits on top if we don't do this :(

            // Hide the main handbox form - reduce screen clutter
            FilterWheelSim.m_MainForm.Hide();

            if (SetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Update the hardware config
                UpdateSettings();
                LogTraffic("  (setup OK)");
            }
            else
            {
                LogTraffic("  (setup Cancel)");
            }

            SetupDialog.Close();
            SetupDialog.Dispose();

            // Show the main handbox form
            FilterWheelSim.m_MainForm.Show();
        }