예제 #1
0
        private void done_option_Click(object sender, EventArgs e)
        {
            ParentForm.Hide();
            IListener udplistener = new UDPListener(textAddr.Text, int.Parse(waterMarkTextBox1.Text));
            ISender   udpsender   = new UDPSender(textAddr.Text, int.Parse(waterMarkTextBox1.Text));
            GameArea  game        = new GameArea(ParentForm, udplistener, udpsender);

            game.Show();
        }
예제 #2
0
        private void done_option_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textAddr.Text) || string.IsNullOrWhiteSpace(textPort.Text))
            {
                MessageBox.Show("Please enter an IP Address and/or Port Number");
            }

            ParentForm.Hide();

            string    url        = $"http://{textAddr.Text}:{textPort.Text}/";
            var       connection = new HubConnection(url);
            IHubProxy hubProxy   = connection.CreateHubProxy("GameHub");

            connection.Start().Wait();

            IListener udplistener = new WebSocketListener(hubProxy);
            ISender   udpsender   = new WebSocketSender(hubProxy);

            GameArea game = new GameArea(ParentForm, udplistener, udpsender);

            game.Show();
        }