Exemplo n.º 1
0
 private void btnHost_Click(object sender, EventArgs e)
 {
     Server = new Server.ServerForm();
     Server.Show();
     System.Threading.Thread.Sleep(1500);
     Client = new Client.ClientForm();
     Client.Connect(IPAddress.Parse("127.0.0.1"));
     Client.Show();
     this.Hide();
 }
Exemplo n.º 2
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.º 3
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;
                }
            }
        }
 public NotificationForm(ClientForm form)
 {
     Client     = form;
     this.Owner = form;
     InitializeComponent();
 }
Exemplo n.º 5
0
 public ClientConnection(ClientForm form, Func <Connection, Exception, Task> callback) : base("Server", callback)
 {
     Form            = form;
     base.Receieved += parseJson;
 }