public PS3RockbandControlerEvents(Form Parent) { jst = new Joystick(Parent.Handle); // TimerDRUMS.Interval = DefaultDrumInterval; TimerDRUMS.Period = DefaultDrumInterval; TimerDRUMS.Mode = Multimedia.TimerMode.Periodic; TimerDRUMS.Tick += new EventHandler(TimerDRUMS_Tick); }
private void Form1_Load(object sender, EventArgs e) { // Initializing joystick jst = new JoystickInterface.Joystick(this.Handle); string[] sticks = jst.FindJoysticks(); if (sticks.Length > 0) { // Connect to the first found joystick device if (jst.AcquireJoystick(sticks[0]) == true) { JoyCon.Text = "Connected"; // Request the status of joystick in cycle. timer1.Enabled = true; } else { JoyCon.Text = "Error"; } } else { JoyCon.Text = "Disconnected"; } // Connecting to the robot controller CtrlConn.Text = "Connecting..."; try { // Making TCP/IP v4 socket Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Sock.Connect(hostEndPoint); // Receiving the Hello message Sock.Receive(remdata); CtrlRcv.Text = Encoding.ASCII.GetString(remdata); if (CtrlRcv.Text == "Hello") { CtrlConn.Text = "Connected"; // Making request DtSnt.Status = true; DtSnt.X = 0; DtSnt.Y = 0; DtSnt.Z = 0; TmrData.Enabled = false; } } catch (SocketException se) { CtrlRcv.Text = se.ErrorCode.ToString(); CtrlConn.Text = "Error"; } }
public PS3RockbandControlerEvents(Form Parent, bool GetPad, RockBandDrumControler RBDC) { jst = new Joystick(Parent.Handle); //TimerDRUMS.Interval = DefaultDrumInterval; TimerDRUMS.Period = DefaultDrumInterval; TimerDRUMS.Mode = Multimedia.TimerMode.Periodic; TimerDRUMS.Tick += new EventHandler(TimerDRUMS_Tick); if (GetPad) { GetRockBandDrumKit(); } if (RBDC != null) { DrumsSetControler = RBDC; } }