コード例 #1
0
        /// <summary>
        /// must return promptly
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="jss"></param>
        private void Joystick_joystickEvent(object sender, IJoystickSubState jss)
        {
            jss.IsNew           = false;
            currentJoystickData = (IJoystickSubState)jss.Clone();
            string command = jss.GetCommand();

            if (!string.IsNullOrWhiteSpace(command))
            {
                //Debug.WriteLine("Joystick event: command: " + command);
                this.ControlDeviceCommand(command);
            }
        }
コード例 #2
0
        /// <summary>
        /// supports polling requests for latest Joystick SubState.
        /// </summary>
        /// <returns></returns>
        public IJoystickSubState GetJoystickSubState()
        {
            lock (jssLock)
            {
                if (jssCurrent != null && !jssCurrent.Equals(jssLast))     // only do something if the joystick state changed
                {
                    jssLast       = (IJoystickSubState)jssCurrent.Clone();
                    jssLast.IsNew = true;
                }
            }

            return(jssLast);
        }
コード例 #3
0
 /// <summary>
 /// must return promptly
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="jss"></param>
 private void Joystick_joystickEvent(object sender, IJoystickSubState jss)
 {
     jss.IsNew = false;
     currentJoystickData = (IJoystickSubState)jss.Clone();
     string command = jss.GetCommand();
     if (!string.IsNullOrWhiteSpace(command))
     {
         //Debug.WriteLine("Joystick event: command: " + command);
         this.ControlDeviceCommand(command);
     }
 }