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; } } }
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); } } } }
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); } } }