protected override object GetElementKey(ConfigurationElement element)
        {
            HostConfigurationElement typedElement = element as HostConfigurationElement;

            if (typedElement == null)
            {
                return(null);
            }
            return(typedElement.Hostname);
        }
        private bool TryGetSelectedServer(out ServerConfigurationElement emulator, out HostConfigurationElement server)
        {
            if (TryGetSelectedEmulator(out emulator) == false)
            {
                server = null;
                return false;
            }
            else if (c_ComboBox_Servers.SelectedIndex == -1 && m_LastSelectedServer == null)
            {
                server = null;
                return false;
            }
            else if (c_ComboBox_Servers.SelectedIndex == -1 && m_LastSelectedServer != null)
            {
                server = m_LastSelectedServer;
                return true;
            }

            string serverName = c_ComboBox_Servers.SelectedItem.ToString();
            server = emulator.Hosts.GetByHostName(serverName);
            return true;
        }
        private void DoDisplayServerStatus()
        {
            try
            {
                ServerConfigurationElement server;
                HostConfigurationElement host;
                if (TryGetSelectedServer(out server, out host) == false)
                {
                    c_ServerStatus.Text = String.Empty;
                    return;
                }

                if (host.SupportsSecureAuthentication)
                {
                    c_CheckBox_SecureAuthentication.Enabled = true;
                    c_CheckBox_SecureAuthentication.Checked = true;
                    c_TextBox_Port.Text = host.SecureAuthenticationPort.ToString();
                }
                else
                {
                    c_CheckBox_SecureAuthentication.Enabled = false;
                    c_CheckBox_SecureAuthentication.Checked = false;
                    c_TextBox_Port.Text = host.AuthenticationPort.ToString();
                }

                if (server.IsSinglePlayer)
                {
                    c_ServerStatus.Text = "READY";
                    c_Button_Check.Enabled = false;
                }
                else
                {
                    c_ServerStatus.Text = "CHECKING";
                    c_Button_Check.Enabled = true;
                    DoCheckServerStatus(host);
                }

                m_LastSelectedServer = host;
            }
            catch (Exception e)
            {
                Program.LogException(e);
                DisplayErrorMessage("Could not retrieve server status.", e);
                c_ServerStatus.Text = String.Empty;
            }
        }
 private void DoCheckServerStatus(HostConfigurationElement host)
 {
     string hostName = host.Hostname;
     int port = 3809; //check the proxy listener, not SSL anymore.
     DoCheckServerStatus(hostName, port);
 }