Example #1
0
 public static void SetupDialog(int clientNumber)
 {
     TL.LogMessage(clientNumber, "SetupDialog", "Connected: " + IsHardwareConnected().ToString());
     if (IsHardwareConnected())
     {
         MessageBox.Show("Simulator is connected, setup parameters cannot be changed, please press OK");
     }
     else
     {
         TL.LogMessage(clientNumber, "SetupDialog", "Creating setup form");
         using (setupForm = new SetupDialogForm())
         {
             TL.LogMessage(clientNumber, "SetupDialog", "Showing Dialogue");
             var result = setupForm.ShowDialog();
             TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed");
             if (result == DialogResult.OK)
             {
                 TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed with OK status");
                 WriteProfile(); // Persist device configuration values to the ASCOM Profile store
             }
             else
             {
                 TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed with Cancel status");
             }
         }
         if (!(setupForm == null))
         {
             setupForm.Dispose();
             setupForm = null;
         }
     }
 }
Example #2
0
        /// <summary>
        /// Displays the Setup Dialogue form.
        /// If the user clicks the OK button to dismiss the form, then
        /// the new settings are saved, otherwise the old values are reloaded.
        /// THIS IS THE ONLY PLACE WHERE SHOWING USER INTERFACE IS ALLOWED!
        /// </summary>
        public void SetupDialog()
        {
            // consider only showing the setup dialogue if not connected
            // or call a different dialogue if connected
            if (IsConnected)
            {
                MessageBox.Show("Already connected, just press OK");
            }

            using (SetupDialogForm F = new SetupDialogForm(TL))
            {
                var result = F.ShowDialog();
                if (result == DialogResult.OK)
                {
                    WriteProfile(); // Persist device configuration values to the ASCOM Profile store
                }
            }
        }
Example #3
0
        public void DoSetupDialog()
        {
            using (SetupDialogForm setupForm = new SetupDialogForm())
            {
                setupForm.VersionOneOnly           = TelescopeHardware.VersionOneOnly;
                setupForm.CanFindHome              = TelescopeHardware.CanFindHome;
                setupForm.CanPark                  = TelescopeHardware.CanPark;
                setupForm.NumberMoveAxis           = TelescopeHardware.NumberMoveAxis;
                setupForm.OnTop                    = TelescopeHardware.OnTop;
                setupForm.CanPulseGuide            = TelescopeHardware.CanPulseGuide;
                setupForm.CanSetEquatorialRates    = TelescopeHardware.CanSetEquatorialRates;
                setupForm.CanSetGuideRates         = TelescopeHardware.CanSetGuideRates;
                setupForm.CanSetPark               = TelescopeHardware.CanSetPark;
                setupForm.CanSetPierSide           = TelescopeHardware.CanSetPierSide;
                setupForm.CanSetTracking           = TelescopeHardware.CanSetTracking;
                setupForm.CanSlew                  = TelescopeHardware.CanSlew;
                setupForm.CanAlignmentMode         = TelescopeHardware.CanAlignmentMode;
                setupForm.AlignmentMode            = TelescopeHardware.AlignmentMode;
                setupForm.CanOptics                = TelescopeHardware.CanOptics;
                setupForm.ApertureArea             = TelescopeHardware.ApertureArea;
                setupForm.ApertureDiameter         = TelescopeHardware.ApertureDiameter;
                setupForm.FocalLength              = TelescopeHardware.FocalLength;
                setupForm.CanSlewAltAz             = TelescopeHardware.CanSlewAltAz;
                setupForm.CanSlewAltAzAsync        = TelescopeHardware.CanSlewAltAzAsync;
                setupForm.CanSlewAsync             = TelescopeHardware.CanSlewAsync;
                setupForm.CanSync                  = TelescopeHardware.CanSync;
                setupForm.CanSyncAltAz             = TelescopeHardware.CanSyncAltAz;
                setupForm.CanUnpark                = TelescopeHardware.CanUnpark;
                setupForm.CanAltAz                 = TelescopeHardware.CanAltAz;
                setupForm.CanDateTime              = TelescopeHardware.CanDateTime;
                setupForm.CanDoesRefraction        = TelescopeHardware.CanDoesRefraction;
                setupForm.CanEquatorial            = TelescopeHardware.CanEquatorial;
                setupForm.CanLatLongElev           = TelescopeHardware.CanLatLongElev;
                setupForm.CanPierSide              = TelescopeHardware.CanPierSide;
                setupForm.CanDestinationSideOfPier = TelescopeHardware.CanDestinationSideofPier;
                setupForm.CanDualAxisPulseGuide    = TelescopeHardware.CanDualAxisPulseGuide;
                setupForm.AutoTrack                = TelescopeHardware.AutoTrack;
                setupForm.DisconnectOnPark         = TelescopeHardware.DisconnectOnPark;
                setupForm.Refraction               = TelescopeHardware.Refraction;
                setupForm.CanTrackingRates         = TelescopeHardware.CanTrackingRates;
                setupForm.CanSiderealTime          = TelescopeHardware.CanSiderealTime;
                setupForm.NoCoordinatesAtPark      = TelescopeHardware.NoCoordinatesAtPark;
                setupForm.EquatorialSystem         = TelescopeHardware.EquatorialSystem;
                setupForm.Elevation                = TelescopeHardware.Elevation;
                setupForm.Latitude                 = TelescopeHardware.Latitude;
                setupForm.Longitude                = TelescopeHardware.Longitude;
                setupForm.MaximumSlewRate          = TelescopeHardware.MaximumSlewRate;
                setupForm.NoSyncPastMeridian       = TelescopeHardware.NoSyncPastMeridian;
                this.BringToFront();
                DialogResult ans = setupForm.ShowDialog(this);

                if (ans == DialogResult.OK)
                {
                    TelescopeHardware.VersionOneOnly           = setupForm.VersionOneOnly;
                    TelescopeHardware.CanFindHome              = setupForm.CanFindHome;
                    TelescopeHardware.CanPark                  = setupForm.CanPark;
                    TelescopeHardware.NumberMoveAxis           = setupForm.NumberMoveAxis;
                    TelescopeHardware.OnTop                    = setupForm.OnTop;
                    TelescopeHardware.CanPulseGuide            = setupForm.CanPulseGuide;
                    TelescopeHardware.CanSetEquatorialRates    = setupForm.CanSetEquatorialRates;
                    TelescopeHardware.CanSetGuideRates         = setupForm.CanSetGuideRates;
                    TelescopeHardware.CanSetPark               = setupForm.CanSetPark;
                    TelescopeHardware.CanSetPierSide           = setupForm.CanSetPierSide;
                    TelescopeHardware.CanSetTracking           = setupForm.CanSetTracking;
                    TelescopeHardware.CanSlew                  = setupForm.CanSlew;
                    TelescopeHardware.CanAlignmentMode         = setupForm.CanAlignmentMode;
                    TelescopeHardware.AlignmentMode            = setupForm.AlignmentMode;
                    TelescopeHardware.CanOptics                = setupForm.CanOptics;
                    TelescopeHardware.ApertureArea             = setupForm.ApertureArea;
                    TelescopeHardware.ApertureDiameter         = setupForm.ApertureDiameter;
                    TelescopeHardware.FocalLength              = setupForm.FocalLength;
                    TelescopeHardware.CanSlewAltAz             = setupForm.CanSlewAltAz;
                    TelescopeHardware.CanSlewAltAzAsync        = setupForm.CanSlewAltAzAsync;
                    TelescopeHardware.CanSlewAsync             = setupForm.CanSlewAsync;
                    TelescopeHardware.CanSync                  = setupForm.CanSync;
                    TelescopeHardware.CanSyncAltAz             = setupForm.CanSyncAltAz;
                    TelescopeHardware.CanUnpark                = setupForm.CanUnpark;
                    TelescopeHardware.CanAltAz                 = setupForm.CanAltAz;
                    TelescopeHardware.CanDateTime              = setupForm.CanDateTime;
                    TelescopeHardware.CanDoesRefraction        = setupForm.CanDoesRefraction;
                    TelescopeHardware.CanEquatorial            = setupForm.CanEquatorial;
                    TelescopeHardware.CanLatLongElev           = setupForm.CanLatLongElev;
                    TelescopeHardware.CanPierSide              = setupForm.CanPierSide;
                    TelescopeHardware.CanDestinationSideofPier = setupForm.CanDestinationSideOfPier;
                    TelescopeHardware.CanDualAxisPulseGuide    = setupForm.CanDualAxisPulseGuide;
                    TelescopeHardware.AutoTrack                = setupForm.AutoTrack;
                    TelescopeHardware.DisconnectOnPark         = setupForm.DisconnectOnPark;
                    TelescopeHardware.Refraction               = setupForm.Refraction;
                    TelescopeHardware.CanTrackingRates         = setupForm.CanTrackingRates;
                    TelescopeHardware.CanSiderealTime          = setupForm.CanSiderealTime;
                    TelescopeHardware.NoCoordinatesAtPark      = setupForm.NoCoordinatesAtPark;
                    TelescopeHardware.EquatorialSystem         = setupForm.EquatorialSystem;
                    TelescopeHardware.Elevation                = setupForm.Elevation;
                    TelescopeHardware.Latitude                 = setupForm.Latitude;
                    TelescopeHardware.Longitude                = setupForm.Longitude;
                    TelescopeHardware.MaximumSlewRate          = setupForm.MaximumSlewRate;
                    TelescopeHardware.NoSyncPastMeridian       = setupForm.NoSyncPastMeridian;

                    this.TopMost = setupForm.OnTop;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Displays the Setup Dialog form.
        /// If the user clicks the OK button to dismiss the form, then
        /// the new settings are saved, otherwise the old values are reloaded.
        /// </summary>
        public void SetupDialog()
        {
            var f = new SetupDialogForm();

            f.ShowDialog();
        }