Exemplo n.º 1
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            Client = new Client.ClientForm();
            string input = Interaction.InputBox("Enter ze IP", "Schnell", Program.DefaultIP);

            if (IPAddress.TryParse(input, out var address))
            {
                if (Client.Connect(address))
                {
                    Client.Show();
                    this.Hide();
                }
                else
                {
                    Client.Close();
                    Client = null;
                }
            }
            else
            {
                MessageBox.Show("IPAddress could not be parsed from your input.\nPerhaps try to read the prompt next time, eh?");
            }
        }
Exemplo n.º 2
0
        private void dgvServers_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            var row  = dgvServers.Rows[e.RowIndex];
            var cell = row.Cells[2];

            if (IPAddress.TryParse(cell.Value.ToString(), out var ip))
            {
                Client = new Client.ClientForm();
                if (Client.Connect(ip))
                {
                    Client.Show();
                    this.Hide();
                }
                else
                {
                    Client.Close();
                    Client = null;
                }
            }
        }