private void btnCancelSet_Click(object sender, RoutedEventArgs e) { IsHitTestVisible = false; tbButtonCancel.Text = "Waiting..."; _gamepad.PollAsync(); EventHandler handler = null; handler = (o, x) => Dispatcher.Invoke(delegate { Settings.Default.buttonCancel = (int)o; _gamepad.CancelPollAsync(); _gamepad.ButtonPressed -= handler; IsHitTestVisible = true; }); _gamepad.ButtonPressed += handler; }
private void AquireGamepad() { gamePad = new Legacy.Gamepad(this); if (gamePad.IsValid == false) return; gamePad.ButtonPressed += gamePad_ButtonPressed; gamePad.DirectionChanged += gamePad_DirectionChanged; gamePad.PollAsync(); }
private void AquireGamepad() { gamePad = new Legacy.Gamepad(this); if (gamePad.IsValid == false) { return; } gamePad.ButtonPressed += gamePad_ButtonPressed; gamePad.DirectionChanged += gamePad_DirectionChanged; gamePad.PollAsync(); }
private void wndFullScreen_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (gamePad == null) { return; } if (IsVisible) { if (gamePad == null) { return; } gamePad.CancelPollAsync(); gamePad.PollAsync(); } else { gamePad.CancelPollAsync(); } }