Пример #1
0
 private void AquireGamepad()
 {
     if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully)
     {
         this.gamePad = new Gamepad(this);
         if (this.gamePad.IsValid)
         {
             this.gamePad.ButtonPressed += new EventHandler(this.gamePad_ButtonPressed);
             this.gamePad.DirectionChanged += new EventHandler(this.gamePad_DirectionChanged);
             this.gamePad.PollAsync();
         }
     }
 }
Пример #2
0
 private void cbEnableGamepad_Checked(object sender, RoutedEventArgs e)
 {
     if (this.cbEnableGamepad.IsChecked.Value)
     {
         if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully)
         {
             this._gamepad = new Gamepad(this);
             if (!this._gamepad.IsValid)
             {
                 this.cbEnableGamepad.IsChecked = false;
                 Tools.ShowMessage("Error enabling gamepad", MessageType.Error);
             }
         }
         else
         {
             Tools.ShowMessage("Error enabling gamepad [Error code: 10045]", MessageType.Error);
             this.cbEnableGamepad.IsChecked = false;
         }
     }
 }