예제 #1
0
        private Image GetDpadImage(XboxDpadDirection direction)
        {
            Image targetImage;

            switch (direction)
            {
            case XboxDpadDirection.Off:
                targetImage = null;
                break;

            case XboxDpadDirection.Up:
                targetImage = this.imageDpadUp;
                break;

            case XboxDpadDirection.Down:
                targetImage = this.imageDpadDown;
                break;

            case XboxDpadDirection.Left:
                targetImage = this.imageDpadLeft;
                break;

            case XboxDpadDirection.Right:
                targetImage = this.imageDpadRight;
                break;

            default:
                throw new NotImplementedException(
                          "Not implemented xbox dpad direction: " + direction);
            }

            return(targetImage);
        }
예제 #2
0
            public PresetDpadVersionOne(XboxDpadDirection direction, string key)
            {
                if (key == null)
                {
                    throw new ArgumentNullException("key");
                }

                this.Direction   = direction;
                this.KeyboardKey = key;
            }
예제 #3
0
        private bool IsDpadHightlighted(XboxDpadDirection direction)
        {
            var dpadImage = this.GetDpadImage(direction);

            if (dpadImage != null)
            {
                return(dpadImage.Visibility == Visibility.Visible);
            }

            return(false);
        }
예제 #4
0
        private void HighlightDpad(XboxDpadDirection direction)
        {
            if (direction == XboxDpadDirection.Off)
            {
                return;
            }

            Image dpadImage       = this.GetDpadImage(direction);
            bool  shouldHighlight = this.XinputController.GetButtonState((XinputButton)(uint)direction);

            this.SetImageVisibility(dpadImage, shouldHighlight);
        }
        public static bool SetDPad(uint userIndex, XboxDpadDirection directions)
        {
            if (!VirtualXboxController.IsOwned(userIndex))
            {
                return(false);
            }

            if (NativeMethods.SetDpad(userIndex, (int)directions))
            {
                states[(int)userIndex - 1].DpadDirections = directions;
                return(true);
            }

            return(false);
        }
 public static bool GetDpadDirectionValue(uint userIndex, XboxDpadDirection direction)
 {
     return(states[(int)userIndex - 1].DpadDirections.HasFlag(direction));
 }