public GamePadWrapper(DependencyObject owner) { _owner = owner; WpfGamePad.AddThumbLeftChangeHandler(owner, OnBlockPosChanged); WpfGamePad.AddTriggerLeftChangeHandler(owner, OnChangeCase); WpfGamePad.AddTriggerRightChangeHandler(owner, OnChangeSymbols); WpfGamePad.AddButtonADownHandler(owner, OnCharUp); WpfGamePad.AddButtonBDownHandler(owner, OnCharRight); WpfGamePad.AddButtonXDownHandler(owner, OnCharLeft); WpfGamePad.AddButtonYDownHandler(owner, OnCharDown); WpfGamePad.AddDPadLeftDownHandler(owner, OnMoveLeftDown); WpfGamePad.AddDPadRightDownHandler(owner, OnMoveRightDown); WpfGamePad.AddDPadDownDownHandler(owner, OnEnterDown); WpfGamePad.AddButtonStartDownHandler(owner, OnEnterDown); WpfGamePad.AddButtonLeftShoulderDownHandler(owner, OnDeleteDown); WpfGamePad.AddButtonRightShoulderDownHandler(owner, OnSpaceDown); WpfGamePad.AddDPadLeftUpHandler(owner, OnMoveLeftUp); WpfGamePad.AddDPadRightUpHandler(owner, OnMoveRightUp); WpfGamePad.AddDPadDownUpHandler(owner, OnEnterUp); WpfGamePad.AddButtonStartUpHandler(owner, OnEnterUp); WpfGamePad.AddButtonLeftShoulderUpHandler(owner, OnDeleteUp); WpfGamePad.AddButtonRightShoulderUpHandler(owner, OnSpaceUp); }
public void Dispose() { WpfGamePad.RemoveButtonRightStickDownHandler(_owner, OnHideLegend); WpfGamePad.RemoveThumbLeftChangeHandler(_owner, OnBlockPosChanged); WpfGamePad.RemoveThumbRightChangeHandler(_owner, OnRightThumbChanged); WpfGamePad.RemoveTriggerLeftChangeHandler(_owner, OnChangeCase); WpfGamePad.RemoveTriggerRightChangeHandler(_owner, OnChangeSymbols); WpfGamePad.RemoveButtonADownHandler(_owner, OnCharUp); WpfGamePad.RemoveButtonBDownHandler(_owner, OnCharRight); WpfGamePad.RemoveButtonXDownHandler(_owner, OnCharLeft); WpfGamePad.RemoveButtonYDownHandler(_owner, OnCharDown); WpfGamePad.RemoveDPadLeftDownHandler(_owner, OnMoveLeftDown); WpfGamePad.RemoveDPadRightDownHandler(_owner, OnMoveRightDown); WpfGamePad.RemoveDPadDownDownHandler(_owner, OnEnterDown); WpfGamePad.RemoveButtonStartDownHandler(_owner, OnEnterDown); WpfGamePad.RemoveButtonLeftShoulderDownHandler(_owner, OnDeleteDown); WpfGamePad.RemoveButtonRightShoulderDownHandler(_owner, OnSpaceDown); WpfGamePad.AddDPadLeftUpHandler(_owner, OnMoveLeftUp); WpfGamePad.AddDPadRightUpHandler(_owner, OnMoveRightUp); WpfGamePad.AddDPadDownUpHandler(_owner, OnEnterUp); WpfGamePad.AddButtonStartUpHandler(_owner, OnEnterUp); WpfGamePad.AddButtonLeftShoulderUpHandler(_owner, OnDeleteUp); WpfGamePad.AddButtonRightShoulderUpHandler(_owner, OnSpaceUp); }
public void Disable() { BlockNavigator.SetIsDisabled(this, false); WpfGamePad.RemoveThumbLeftChangeHandler(this, OnLeftThumbChanged); WpfGamePad.RemoveButtonADownHandler(this, OnButtonA); WpfGamePad.RemoveButtonBDownHandler(this, OnButtonB); WpfGamePad.SetIsFocused(this, false); WpfGamePad.SetRegistered(this, false); CenterHighlight.Visibility = Visibility.Collapsed; }
public void Enable() { BlockNavigator.SetIsDisabled(this, true); WpfGamePad.AddThumbLeftChangeHandler(this, OnLeftThumbChanged); WpfGamePad.AddButtonADownHandler(this, OnButtonA); WpfGamePad.AddButtonBDownHandler(this, OnButtonB); WpfGamePad.SetRegistered(this, true); WpfGamePad.SetIsFocused(this, true); CenterHighlight.Visibility = Visibility.Visible; HighlightKnob.Visibility = Visibility.Collapsed; _activeButtonIndex = -1; Canvas.SetLeft(CenterHighlight, _centerHighlightCanvasSize.X / 2 - CenterHighlight.Width / 2); Canvas.SetTop(CenterHighlight, _centerHighlightCanvasSize.Y / 2 - CenterHighlight.Height / 2); }