示例#1
0
        }//end pctLinLogo_Click

        private void LauncherForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (!e.Control || !e.Shift || e.KeyCode != Keys.A)
            {
                return;
            }

            var addServerForm = new AddServerForm();

            if (addServerForm.ShowDialog() == DialogResult.OK)
            {
                if (this._config.Servers.ContainsKey(addServerForm.txtName.Text))
                {
                    MessageBox.Show("A server with that name has already been added.");
                    return;
                }

                this._config.Servers.Add(addServerForm.txtName.Text, new Server
                {
                    IpOrDns = addServerForm.txtIpAddress.Text,
                    Port    = Convert.ToInt32(addServerForm.txtPort.Text)
                });

                if (addServerForm.chkPermanent.Checked)
                {
                    Helpers.SetConfigValue(this._config.KeyName,
                                           "Servers",
                                           string.Format(",{0}:{1}:{2}", addServerForm.txtName.Text, addServerForm.txtIpAddress.Text, addServerForm.txtPort.Text)
                                           , true);
                }

                this.cmbServer.Items.Add(addServerForm.txtName.Text);
                this.cmbServer.SelectedIndex = cmbServer.Items.Count - 1;
            } //end if
        }     //end LauncherForm_KeyDown