Пример #1
0
        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);
        }
Пример #2
0
        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);
        }