private void CmdBasic2ViaAscom_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(cmbBasic2SerialPort.Text)) { MessageBox.Show("Please select a com port before switching to serial."); return; } DumpLine("Switching to ASCOM..."); Cursor.Current = Cursors.WaitCursor; EsMount mount = GetMountFromGUI(); try { mount = MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { Console.WriteLine("error"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount?.ConnectionSettings?.IsConnected == ConnectionEnum.Serial) { MessageBox.Show("Mount is already connected via serial", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.Serial); Dump("Sucessfully switched to serial (ASCOM) mode"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + esEx.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { Dump("Could not switch."); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaTCP_Click(object sender, EventArgs e) { EsMount mount = GetMountFromGUI(); try { if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to TCP..."); MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { Dump("Already on TCP"); MessageBox.Show("Mount is already connected via TCP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Switching from UDP..."); MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } Cursor.Current = Cursors.WaitCursor; mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.TCP); Dump("Success - switched to TCP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("Could not switch to TCP." + Environment.NewLine + esEx.Message); } catch (Exception ex) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("Could not switch to TCP." + Environment.NewLine + ex.ToString()); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaUdp_Click(object sender, EventArgs e) { EsMount mount = null; try { if (cmbBasic2MountType.Text == "G11" || cmbBasic2MountType.Text == "Exos-2") { MessageBox.Show("G-11 and EXOS-2 user do not need to use UDP mode."); return; } if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to UDP..."); mount = GetMountFromGUI(); MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Mount is already on UDP"); MessageBox.Show("Mount is already connected via UDP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.UDP); Dump("Succesfully switched to UDP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch to UDP"); MessageBox.Show("Could not switch to UDP." + Environment.NewLine); } catch (Exception ex) { Dump("Could not switch to UDP"); MessageBox.Show("Could not switch to UDP." + Environment.NewLine); } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaAscom_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(cmbBasic2SerialPort.Text)) { MessageBox.Show("Please select a com port before switching to serial."); return; } DumpLine("Switching to ASCOM..."); Cursor.Current = Cursors.WaitCursor; EsMount mount = GetMountFromGUI(); try { mount = MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial) { MessageBox.Show("Mount is already connected via serial"); return; } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.Serial); Dump("Sucessfully switched to serial (ASCOM) mode"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + esEx.Message); } catch (Exception ex) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + ex.ToString()); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaUdp_Click(object sender, EventArgs e) { EsMount mount = null; bool setSsidTimer = false; try { if (cmbBasic2MountType.Text == "G11" || cmbBasic2MountType.Text == "Exos-2") { MessageBox.Show("G-11 and EXOS-2 user do not need to use UDP mode."); return; } if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to UDP..."); mount = GetMountFromGUI(); MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { setSsidTimer = true; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Mount is already on UDP"); MessageBox.Show("Mount is already connected via UDP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.UDP); Dump("Succesfully switched to UDP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch to UDP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Dump("Could not switch to UDP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (setSsidTimer) { TurnOnSsIdTimer(); } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaTCP_Click(object sender, EventArgs e) { EsMount mount = GetMountFromGUI(); bool setSsidTimer = false; try { if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DumpLine("Switching to TCP..."); MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { setSsidTimer = true; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { Dump("Already on TCP"); MessageBox.Show("Mount is already connected via TCP", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Switching from UDP..."); MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } Cursor.Current = Cursors.WaitCursor; mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.TCP); Dump("Success - switched to TCP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor.Current = Cursors.Default; } if (setSsidTimer) { TurnOnSsIdTimer(); } UpdateTabStripConnection(mount); }