コード例 #1
0
 private void MainClass_Load(object sender, System.EventArgs e)
 {
     if (!myJStick.InitDirectInput())
     {
         MessageBox.Show("No input device was found!");
     }
     else
     {
         this.socket = new UDPClientASocket();
         //Start controller timer
         timer1.Start();
     }
 }
コード例 #2
0
        private void menuItem5_Click(object sender, System.EventArgs e)
        {
            switch (this.menuItem5.Text)
            {
            case "Connect":
                this.socket = null;
                this.socket = new UDPClientASocket();
                this.socket.ConnectTo(this.remoteIPString, this.sendPort, this.rcvPort);
                this.menuItem5.Text = "Disconnect";
                break;

            case "Disconnect":
                this.socket.Close();
                this.menuItem5.Text = "Connect";
                break;
            }
        }
コード例 #3
0
        private void menuItem4_Click(object sender, System.EventArgs e)
        {
            ConnectionSetupForm connSet;

            if (this.remoteIPString == null)
            {
                connSet = new ConnectionSetupForm();
            }
            else
            {
                connSet = new ConnectionSetupForm(this.remoteIPString, this.sendPort, this.rcvPort);
            }
            if (connSet.ShowDialog() == DialogResult.OK)
            {
                if (this.socket.Connected)
                {
                    this.socket.Close();
                }
                this.socket         = null;
                this.socket         = new UDPClientASocket();
                this.remoteIPString = connSet.ipTextBox.Text;
                this.sendPort       = int.Parse(connSet.sendTextBox.Text);
                this.rcvPort        = int.Parse(connSet.rcvTextBox.Text);
                try
                {
                    this.socket.ConnectTo(this.remoteIPString, this.sendPort, this.rcvPort);
                    this.menuItem5.Text    = "Disconnect";
                    this.menuItem5.Enabled = true;
                }
                catch (System.OverflowException)
                {
                    MessageBox.Show("Not a valid port Number\r\nPort Range: 0-65536");
                }
                catch (System.FormatException)
                {
                    MessageBox.Show("Not a valid IP Address\r\nOR ports must be integer numbers");
                }
                catch (System.Net.Sockets.SocketException)
                {
                    MessageBox.Show("Remote Host could not be reached!");
                }
            }
        }
コード例 #4
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            myJStick = new ZalJoystick(this, JOYSTICK_MAX);
            myJStick.InitDirectInput();
            this.gamepadThold = 50;
            this.axisCount    = 0;
            this.axisFRSign   = new int[4];
            this.socket       = new UDPClientASocket();

            this.x           = this.Width / 2;
            this.y           = this.Height / 2;
            this.guiCircle   = new ZalCircle(this.ClientSize.Width / 2, this.ClientSize.Height / 2, this.ClientSize.Width / 2);
            this.limitCircle = new ZalCircle(0, 0, JOYSTICK_MAX);
            rad45            = (Math.PI / 180) * 45;
        }