Ejemplo n.º 1
0
        public EsMount ChangeMountConnection(EsMount mount, ConnectionEnum newConnection)
        {
            EsMount result = null;

            switch (newConnection)
            {
            case ConnectionEnum.TCP:
                result = ConvertToTCPConnectedMount(mount);
                break;

            case ConnectionEnum.UDP:
                result = ConvertToUDPConnectedMount(mount);
                break;

            case ConnectionEnum.Serial:
                result = ConvertToSerialPConnectedMount(mount);
                break;

            case ConnectionEnum.NONE:
                break;

            default:
                break;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public bool CanVerifyTcpConnection(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Start Verify TCP Connection");

            //Check Wireless first
            if (!CommunicationsManager.IsConnectedToWirelessNetwork())
            {
                return(false);
            }
            if (!CommunicationsManager.ConnectedSsid().Contains("PMC"))
            {
                return(false);
            }
            bool responseIsGood = false;

            try
            {
                string result = CommunicationsManager.SendTcpMessage(mount.ConnectionSettings.IpAddr,
                                                                     mount.ConnectionSettings.IpPort, TCP_QUERY);

                responseIsGood = result.Contains(TCP_RESPONSE);
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Done Verify TCP Connection: " + responseIsGood);

                return(responseIsGood);
            }
            catch (Exception ex)
            {
                EsException e = new EsException("Error in :" + "CanVerifyTcpConnection", ex);
                //TODO:
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Done Verify TCP Connection - Failure");

                return(false);
            }
        }
Ejemplo n.º 3
0
        private EsMount ConvertToUDPConnectedMount(EsMount mount)
        {
            string ipAddr  = mount.ConnectionSettings.IpAddr;
            int    ipPort  = mount.ConnectionSettings.IpPort;
            string comPort = mount.ConnectionSettings.SerPort;

            if (mount == null)
            {
                throw new EsException("The mount must be connected before its connection can be changed");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.NONE)
            {
                throw new EsException("The mount must be connected before its connection can be changed");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP)
            {
                throw new EsException("The mount is already in ExploreStars (UDP) mode");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial)
            {
                CommunicationsManager.SendSerialMessage(comPort, "ESX!");  //TODO: verify its now on tcp
                Thread.Sleep(250);
                mount.ConnectionSettings.IsConnected = ConnectionEnum.TCP;
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP)
            {
                CommunicationsManager.SendTcpMessage(ipAddr, ipPort, "ESY!");
                mount.ConnectionSettings.IsConnected = ConnectionEnum.UDP;
            }
            return(mount);
        }
Ejemplo n.º 4
0
        private EsMount ConvertToSerialPConnectedMount(EsMount mount)
        {
            if (mount == null)
            {
                throw new EsException("The mount is busy.  Please wait a few seconds and then 'Find Your Current Connection'");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.NONE)
            {
                throw new EsException("The mount must be connected before its connection can be changed");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial)
            {
                throw new EsException("The mount is already in ASCOM (serial) mode");
            }
            string ipAddr = mount.ConnectionSettings.IpAddr;
            int    ipPort = mount.ConnectionSettings.IpPort;

            //If it is in udp ,ode, switch it to tcp
            if (mount.MountModel == MountModelEnum.iXos100 && mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP)
            {
                CommunicationsManager.SendUdpMessage(ipAddr, ipPort, "ESY!");
            }
            //switch it to serial
            CommunicationsManager.SendTcpMessage(ipAddr, ipPort, "ESX!");

            //TODO: verify its now on serial
            mount.ConnectionSettings.IsConnected = ConnectionEnum.Serial;
            return(mount);
        }
        private void CmdBasic2CheckCurrentConnection_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                EsMount mount = GetMountFromGUI();
                mount = MountManager.ConnectMount(mount);
                if (mount == null)
                {
                    DumpLine("The mount does not appear to be connected. Please check your settings and network connection.");
                    tsCurrentConnection.Text      = "NONE";
                    tsCurrentConnection.BackColor = Color.Red;
                    return;
                }

                DumpLine("Mount appears to be connected on " + mount?.ConnectionSettings.IsConnected.ToString());
                UpdateTabStripConnection(mount);
                Cursor.Current = Cursors.Default;
                UpdateChangeMethodsButtonsAccess(mount);
            }
            catch (Exception)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Could not determine the current mount connection method.");
            }
            Cursor.Current = Cursors.Default;
        }
        private EsMount GetMountFromGUI()
        {
            EsMount result = new EsMount();

            switch (cmbBasic2MountType.Text)
            {
            case "G11":
                result.MountModel = MountModelEnum.g11;
                break;

            case "iExos100":
                result.MountModel = MountModelEnum.iXos100;
                break;

            case "Xos2":
                result.MountModel = MountModelEnum.Xos2;
                break;

            default:
                result.MountModel = MountModelEnum.NotSet;
                break;
            }
            result.ConnectionSettings.IpAddr = txtBasic2IpAddress.Text;
            result.ConnectionSettings.IpPort = Convert.ToInt32(txtBasic2IpPort.Text);
            if (cmbBasic2SerialPort.Text != "")
            {
                result.ConnectionSettings.SerPort = cmbBasic2SerialPort.Text;
            }
            return(result);
        }
 private void UpdateChangeMethodsButtonsAccess(EsMount mount)
 {
     if (mount == null)
     {
         return;
     }
     if (mount.MountModel == MountModelEnum.iXos100)
     {
         if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial)
         {
             cmdBasic2ViaAscom.Enabled = false;
             cmdBasic2ViaTCP.Enabled   = true;
             cmdBasic2ViaUdp.Enabled   = false;
         }
         if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP)
         {
             cmdBasic2ViaAscom.Enabled = true;
             cmdBasic2ViaTCP.Enabled   = false;
             cmdBasic2ViaUdp.Enabled   = true;
         }
         if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP)
         {
             cmdBasic2ViaAscom.Enabled = false;
             cmdBasic2ViaTCP.Enabled   = true;
             cmdBasic2ViaUdp.Enabled   = false;
         }
     }
     else
     {
         cmdBasic2ViaAscom.Enabled = true;
         cmdBasic2ViaTCP.Enabled   = true;
         cmdBasic2ViaUdp.Enabled   = true;
     }
 }
Ejemplo n.º 8
0
        private EsMount ConvertToTCPConnectedMount(EsMount mount)
        {
            string ipAddr  = mount.ConnectionSettings.IpAddr;
            int    ipPort  = mount.ConnectionSettings.IpPort;
            string comPort = mount.ConnectionSettings.SerPort;

            if (mount == null)
            {
                //throw new EsException("The mount must be connected before its connection can be changed");
                throw new EsException("The mount is busy.  Please wait a few seconds and then 'Find Your Current Connection'");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.NONE)
            {
                throw new EsException("The mount must be connected before its connection can be changed");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP)
            {
                throw new EsException("The mount is already in Wireless ASCOM (TCP) mode");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial)
            {
                CommunicationsManager.SendSerialMessage(comPort, "ESX!");
            }
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP)
            {
                CommunicationsManager.SendUdpMessage(ipAddr, ipPort, "ESY!");
            }
            //TODO: verify its now on tcp
            mount.ConnectionSettings.IsConnected = ConnectionEnum.TCP;
            return(mount);
        }
        private void SaveToProfile()
        {
            Cursor.Current = Cursors.WaitCursor;
            string driverID                   = "ASCOM.ES_PMC8.Telescope";
            string comPort                    = null;
            bool   WirelessEnabled            = true;
            string WirelessProtocol           = "TCP";
            string comPortProfileName         = "COM Port";
            string WirelessEnabledProfileName = "Wireless Enabled";

            EsMount mount = GetMountFromGUI();

            mount = MountManager.ConnectMount(mount);
            if (mount == null)
            {
                mount = MountManager.ConnectMount(mount);
            }
            if (mount == null)
            {
                DumpLine("Configuration not saved! The mount does not appear to be connected. Please check your settings and network connection.");
                tsCurrentConnection.Text      = "NONE";
                tsCurrentConnection.BackColor = Color.Red;
                return;
            }


            // Set wireless
            if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial)
            {
                WirelessEnabled = false;
            }
            else
            {
                Console.WriteLine(mount.ConnectionSettings.IsConnected.ToString());
                WirelessProtocol = mount.ConnectionSettings.IsConnected.ToString();
            }
            comPort = mount.ConnectionSettings.SerPort;

            var driverProfile = new Profile();

            driverProfile.DeviceType = "Telescope";
            driverProfile.WriteValue(driverID, comPortProfileName, comPort.ToString());
            driverProfile.WriteValue(driverID, WirelessEnabledProfileName, WirelessEnabled.ToString());
            driverProfile.WriteValue(driverID, comPortProfileName, comPort.ToString());
            driverProfile.WriteValue(driverID, "Wireless Protocol", WirelessProtocol);
            driverProfile.Dispose();
            string msg = "Port: " + comPort + ", Use Wireless: " + WirelessEnabled + ", Protocol: " + WirelessProtocol;

            DumpLine("Saved Configuration - " + msg);
            Cursor.Current = Cursors.Default;
        }
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
        public void UpdateTabStripConnection(EsMount mount)
        {
            if (mount == null)
            {
                tsCurrentConnection.Text      = "UNKNOWN";
                tsCurrentConnection.BackColor = Color.Orange;
                return;
            }
            //Color oldColor = tsCurrentConnection.BackColor;
            switch (mount?.ConnectionSettings?.IsConnected)
            {
            case ConnectionEnum.NONE:
            {
                tsCurrentConnection.Text      = "NONE";
                tsCurrentConnection.BackColor = Color.Red;
            }
            break;

            case ConnectionEnum.Serial:
            {
                tsCurrentConnection.Text      = "Serial";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            case ConnectionEnum.TCP:
            {
                tsCurrentConnection.Text      = "TCP";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            case ConnectionEnum.UDP:
            {
                tsCurrentConnection.Text      = "UDP";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            default:
                break;
            }
        }
Ejemplo n.º 14
0
        public void UpdateTabStripConnection(EsMount mount)
        {
            Color oldColor = tsCurrentConnection.BackColor;

            switch (mount.ConnectionSettings.IsConnected)
            {
            case ConnectionEnum.NONE:
            {
                tsCurrentConnection.Text      = "NONE";
                tsCurrentConnection.BackColor = Color.Red;
            }
            break;

            case ConnectionEnum.Serial:
            {
                tsCurrentConnection.Text      = "Serial";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            case ConnectionEnum.TCP:
            {
                tsCurrentConnection.Text      = "TCP";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            case ConnectionEnum.UDP:
            {
                tsCurrentConnection.Text      = "UDP";
                tsCurrentConnection.BackColor = Color.Green;
            }
            break;

            default:
                break;
            }
            if (oldColor == Color.Green && tsCurrentConnection.BackColor == Color.Red)
            {
                MessageBox.Show("Connection to the PMC-8 network has been lost.", "Important");
            }
        }
Ejemplo n.º 15
0
        public EsMount ConnectMount(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DetailedInfo, "  Start Connecting to Mount");

            EsMount result    = mount;
            string  ipaddress = mount.ConnectionSettings.IpAddr;
            int     ipPort    = mount.ConnectionSettings.IpPort;
            string  serPort   = mount.ConnectionSettings.SerPort;

            if (!String.IsNullOrWhiteSpace(serPort))
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Try to Verify - Serial Connection");
                if (CanVerifySerialConnection(mount))
                {
                    EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Verified - Serial Connection");
                    result.ConnectionSettings.IsConnected = ConnectionEnum.Serial;
                    return(result);
                }
            }
            if (!String.IsNullOrWhiteSpace(ipaddress))
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Try to Verifiy TCP Connection");
                if (CanVerifyTcpConnection(mount))
                {
                    EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Verified - TCP Connection");
                    result.ConnectionSettings.IsConnected = ConnectionEnum.TCP;
                    return(result);
                }
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Try to Verify UDP Connection");
                if (CanVerifyUdpConnection(mount))
                {
                    EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.GeneralInfo, "Verified - UDP Connection");
                    result.ConnectionSettings.IsConnected = ConnectionEnum.UDP;
                    return(result);
                }
            }
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DetailedInfo, "Failed to Verify Connection Method");

            return(null);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        public bool CanVerifyUdpConnection(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Start Verify UDP Connection");

            //Check Wireless first
            if (!CommunicationsManager.IsConnectedToWirelessNetwork())
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End Verify UDP Connection - Failure. Not connected to a network");

                return(false);
            }
            if (!CommunicationsManager.ConnectedSsid().Contains("PMC"))
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End Verify UDP Connection - Failure. Not connected to a PMC network");

                return(false);
            }
            bool versionGood = false;

            try
            {
                string result = CommunicationsManager.SendUdpMessage(mount.ConnectionSettings.IpAddr,
                                                                     mount.ConnectionSettings.IpPort, UDP_QUERY);

                versionGood = result.Contains(UDP_RESPONSE);
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "     End Verify UDP Connection: " + versionGood);

                return(versionGood);
            }
            catch (Exception ex)
            {
                EsException e = new EsException("Error in :" + "CanVerifyUdpConnection", ex);
                //TODO:
                //EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DetailedInfo, "    End Verify UDP Connection - Failure. ERROR");
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, "CanVerifyUdpConnection", EsMessagePriority.DetailedInfo, "", null, ex, null);
                return(false);
            }
        }
Ejemplo n.º 18
0
        public bool CanVerifySerialConnection(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Start Very Serial Connection");

            string[] ports          = SerialPort.GetPortNames();
            bool     responseIsGood = false;

            if (ports.Rank > 0 && mount.ConnectionSettings.SerPort != null)
            {
                try
                {
                    string result = CommunicationsManager.SendSerialMessage(mount.ConnectionSettings.SerPort, SERIAL_QUERY);
                    responseIsGood = result.Contains(SERIAL_RESPONSE);
                }
                catch (Exception ex)
                {
                    EsException e = new EsException("Error in :" + "CanVerifySerialConnection", ex);
                    throw e;
                }
            }
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End  Very Serial Connection: " + responseIsGood);

            return(responseIsGood);
        }
        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);
        }
 public string SendMessage(EsMount mount, string msg)
 {
     return(null);
 }