Example #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            //okay button

            if (comboBox1.Text.Trim() != "")
            {
                comboBox1.Enabled      = false;
                numericUpDown1.Enabled = false;
                textBox1.Enabled       = false;

                UseWaitCursor = true;

                try
                {
                    Console.WriteLine((await Dns.GetHostAddressesAsync(comboBox1.Text))[0].ToString());

                    connprop = new TCPConnectionProperties(textBox1.Text, comboBox1.Text, Convert.ToInt32(numericUpDown1.Value));
                }
                catch (Exception ex)
                {
                    numericUpDown1.Enabled = true;
                    comboBox1.Enabled      = true;
                    textBox1.Enabled       = true;

                    UseWaitCursor = false;

                    comboBox1.Focus();

                    return;
                }

                ConfigurationManager.AddTCPConnectionHistoryItem(connprop);

                DialogResult = DialogResult.OK;
            }
        }