コード例 #1
0
        void ControllerAxisChanged(ControllerJoystick joystick, ControllerJoystickAxis axis, byte oldValue, byte newValue)
        {
            IDevice device = deviceManager.ActiveDevice;

            if (device != null)
            {
                switch (joystick)
                {
                case ControllerJoystick.Left:
                    switch (axis)
                    {
                    case ControllerJoystickAxis.X:
                        try
                        {
                            device.VerticalFinPosition = newValue;
                        }
                        catch (Exception ex)
                        {
                            //serialData.Text += ex.Message + '\n';
                        }
                        break;

                    case ControllerJoystickAxis.Y:
                        try
                        {
                            device.HorizontalFinPosition = newValue;
                        }
                        catch (Exception ex)
                        {
                            //serialData.Text += ex.Message + '\n';
                        }
                        break;
                    }
                    break;

                case ControllerJoystick.Right:
                    switch (axis)
                    {
                    case ControllerJoystickAxis.Y:

                    {
                        try
                        {
                            device.Thrust = newValue;
                        }
                        catch (Exception ex)
                        {
                            //serialData.Text += ex.Message + '\n';
                        }
                    }
                    break;
                    }
                    break;
                }
            }
        }
コード例 #2
0
 protected void OnControllerAxisChanged(ControllerJoystick joystick, ControllerJoystickAxis axis, byte oldValue, byte newValue)
 {
     if (AxisChanged != null)
     {
         ControllerAxisChangedHandler eventHandler = AxisChanged;
         Delegate[] delegates = eventHandler.GetInvocationList();
         foreach (ControllerAxisChangedHandler handler in delegates)
         {
             DispatcherObject dispatcherObject = handler.Target as DispatcherObject;
             if (dispatcherObject != null && !dispatcherObject.CheckAccess())
             {
                 dispatcherObject.Dispatcher.Invoke(DispatcherPriority.DataBind, handler, joystick, axis, oldValue, newValue);
             }
             else
             {
                 handler(joystick, axis, oldValue, newValue);
             }
         }
     }
 }
コード例 #3
0
ファイル: Controller.cs プロジェクト: ddcc/EERILControlSystem
 protected void OnControllerAxisChanged(ControllerJoystick joystick, ControllerJoystickAxis axis, byte oldValue, byte newValue)
 {
     if (AxisChanged != null)
     {
         ControllerAxisChangedHandler eventHandler = AxisChanged;
         Delegate[] delegates = eventHandler.GetInvocationList();
         foreach (ControllerAxisChangedHandler handler in delegates)
         {
             DispatcherObject dispatcherObject = handler.Target as DispatcherObject;
             if (dispatcherObject != null && !dispatcherObject.CheckAccess())
             {
                 dispatcherObject.Dispatcher.Invoke(DispatcherPriority.DataBind, handler, joystick, axis, oldValue, newValue);
             }
             else
                 handler(joystick, axis, oldValue, newValue);
         }
     }
 }
コード例 #4
0
        void ControllerAxisChanged(ControllerJoystick joystick, ControllerJoystickAxis axis, byte oldValue, byte newValue)
        {
            IDevice device = deviceManager.ActiveDevice;
            if (device != null)
            {
                switch (joystick)
                {
                    case ControllerJoystick.Left:
                        switch (axis)
                        {
                            case ControllerJoystickAxis.X:
                                try
                                {
                                    device.VerticalFinPosition = newValue;
                                }
                                catch (Exception ex)
                                {
                                    //serialData.Text += ex.Message + '\n';
                                }
                                break;
                            case ControllerJoystickAxis.Y:
                                try
                                {
                                    device.HorizontalFinPosition = newValue;
                                }
                                catch (Exception ex)
                                {
                                    //serialData.Text += ex.Message + '\n';
                                }
                                break;
                        }
                        break;
                    case ControllerJoystick.Right:
                        switch (axis)
                        {
                            case ControllerJoystickAxis.Y:

                                {
                                    try
                                    {
                                        device.Thrust = newValue;
                                    }
                                    catch (Exception ex)
                                    {
                                        //serialData.Text += ex.Message + '\n';
                                    }
                                }
                                break;
                        }
                        break;
                }
            }
        }