Exemplo n.º 1
0
        void func_ControllerStateChanged(ControllerStateEventArgs e)
        {
            if (this.Disposing)
            {
                return;
            }
            Invoke((MethodInvoker) delegate
            {
                if (this.Disposing)
                {
                    return;
                }

                pbButtonA.Visible = (e.State.PressedButtons & ControllerState.Buttons.A) == ControllerState.Buttons.A;
                pbButtonB.Visible = (e.State.PressedButtons & ControllerState.Buttons.B) == ControllerState.Buttons.B;

                pbButtonX.Visible = (e.State.PressedButtons & ControllerState.Buttons.X) == ControllerState.Buttons.X;
                pbButtonY.Visible = (e.State.PressedButtons & ControllerState.Buttons.Y) == ControllerState.Buttons.Y;

                pbShoulderLeft.Visible  = (e.State.PressedButtons & ControllerState.Buttons.LeftShoulder) == ControllerState.Buttons.LeftShoulder;
                pbShoulderRight.Visible = (e.State.PressedButtons & ControllerState.Buttons.RightShoulder) == ControllerState.Buttons.RightShoulder;



                pbUp.Visible    = (e.State.DPad & ControllerState.DPadDirection.Up) == ControllerState.DPadDirection.Up;
                pbDown.Visible  = (e.State.DPad & ControllerState.DPadDirection.Down) == ControllerState.DPadDirection.Down;
                pbLeft.Visible  = (e.State.DPad & ControllerState.DPadDirection.Left) == ControllerState.DPadDirection.Left;
                pbRight.Visible = (e.State.DPad & ControllerState.DPadDirection.Right) == ControllerState.DPadDirection.Right;


                pbStart.Visible  = (e.State.PressedButtons & ControllerState.Buttons.Start) == ControllerState.Buttons.Start;
                pbSelect.Visible = (e.State.PressedButtons & ControllerState.Buttons.Back) == ControllerState.Buttons.Back;
            });
        }
        protected void OnControlerStateChanged(ControllerState e)
        {
            ControllerStateEventArgs evt = new ControllerStateEventArgs();

            evt.State = e;
            if (this.ControllerStateChanged != null)
            {
                this.ControllerStateChanged(evt);
            }
        }