private void TelescopeTab_FormClosing(object sender, FormClosingEventArgs e) { if (scope != null && scope.Connected) { scope.Connected = false; scope.Dispose(); scope = null; } }
public void ChooseScope() { string scopeID = AscomTelescope.ChooseTelescope(Properties.Settings.Default.TelescopeID); if (platformInstalled && !String.IsNullOrEmpty(scopeID)) { Properties.Settings.Default.TelescopeID = scopeID; } }
public void Setup_Click(object sender, EventArgs e) { if (platformInstalled && !String.IsNullOrEmpty(Properties.Settings.Default.TelescopeID)) { if (scope == null) { scope = new AscomTelescope(Properties.Settings.Default.TelescopeID); } scope.SetupDialog(); } }
private void TelescopeTab_Load(object sender, EventArgs e) { if (AscomTelescope.IsPlatformInstalled()) { platformInstalled = true; PlatformStatus.Text = Language.GetLocalizedText(402, "Installed"); } else { PlatformStatus.Text = Language.GetLocalizedText(403, "Not Installed"); ConnectScope.Enabled = false; Choose.Enabled = false; Setup.Enabled = false; } }
public void ConnectScope_Click(object sender, EventArgs e) { if (!platformInstalled || !ConnectScope.Enabled) { return; } if (telescopeConnected) { scope.Connected = false; scope.Dispose(); scope = null; telescopeConnected = false; SetControlEnableState(false); ConnectScope.Text = Language.GetLocalizedText(386, "Connect"); telescopeGroup.Text = Language.GetLocalizedText(389, "Telescope Control - Disconnected"); Choose.Enabled = true; } else { if (string.IsNullOrEmpty(Properties.Settings.Default.TelescopeID)) { ChooseScope(); } if (!string.IsNullOrEmpty(Properties.Settings.Default.TelescopeID)) { try { scope = new AscomTelescope(Properties.Settings.Default.TelescopeID); scope.Connected = true; telescopeConnected = true; SetControlEnableState(true); ConnectScope.Text = Language.GetLocalizedText(390, "Disconnect"); telescopeGroup.Text = Language.GetLocalizedText(391, "Telescope Control - Connected"); Choose.Enabled = false; } catch { MessageBox.Show(Language.GetLocalizedText(392, "The telescope failed to connect. Please ensure the correct telescope is chosen, and that its settings are correct."), Language.GetLocalizedText(393, "Telescope control")); } } else { MessageBox.Show(Language.GetLocalizedText(394, "Before you can connect, you need to choose a telescope."), Language.GetLocalizedText(393, "Telescope control")); } } }