public JoystickConfiguration(JoystickAction joystickAction) { InitializeComponent(); Button_Cancel.Click += (object sender, EventArgs e) =>Close(); Button_Appliquer.Click += (object sender, EventArgs e) => { GetJoystickActionOnApply(JoystickProperty.ToJoystickAction()); Close(); }; JoystickHandler.SuspendRobotMovement(); InfoJoystick = JoystickHandler.GetGoystickInformation(); JoystickProperty = new JoystickProperty(joystickAction); PropertyGrid_Joystick.SelectedObject = JoystickProperty; PropertyGrid_Joystick.PropertyValueChanged += (object s, PropertyValueChangedEventArgs e)=> { if ((Axes)e.ChangedItem.Value == Axes.Automatique) { int axeId = JoystickHandler.GetLastAxesMoved(); Axes selectedAxe = (Axes)Enum.GetValues(typeof(Axes)).GetValue(axeId); JoystickProperty.SetProperty(e.ChangedItem.Label, selectedAxe); } else if ((int)((Axes)e.ChangedItem.Value) > InfoJoystick.nbAxes) { MessageBox.Show(Joystick.Resource.JoystickAxeNotFound + " " + (int)((Axes)e.ChangedItem.Value)); JoystickProperty.SetProperty(e.ChangedItem.Label, Axes.Axe0); } }; }
public JoystickProperty(JoystickAction joystickAction) { MoveLeftAndRightAxe = (Axes)Enum.GetValues(typeof(Axes)).GetValue(joystickAction.idAxe_MoveLeftRight); MoveToWardAndBackWardAxe = (Axes)Enum.GetValues(typeof(Axes)).GetValue(joystickAction.idAxe_MoveTowardBackWard); TurnAxe = (Axes)Enum.GetValues(typeof(Axes)).GetValue(joystickAction.idAxe_Turn); }
public static unsafe extern void SetJoyStickAction(JoystickAction pJoystickAction);
public static unsafe extern Int32 EnableJoystickControl(JoystickAction* pJoystickAction);