public GestureService(IBackButtonService backService, IKeyboardService keyService) { Two.BackService = backService as IBackButtonService2; Two.BackService.BackRequested += (s, e) => { BackRequested2?.Invoke(s, e); if (AllowBackRequested) { BackRequested?.Invoke(s, e); } }; Two.BackService.ForwardRequested += (s, e) => { ForwardRequested2?.Invoke(s, e); if (AllowForwardRequested) { ForwardRequested?.Invoke(s, e); } }; Two.KeyService = keyService as IKeyboardService2; Two.KeyService.AfterSearchGesture += (s, e) => AfterSearchGesture?.Invoke(s, e); Two.KeyService.AfterMenuGesture += (s, e) => AfterMenuGesture?.Invoke(s, e); Two.KeyService.AfterKeyDown += (s, e) => AfterKeyDown?.Invoke(s, e); }
/// <remarks> /// This must be called AFTER the first window is created. /// </remarks> void IKeyboardService2.Setup() { _helper = new KeyboardHelper { KeyDown = (e) => { e.Handled = true; if (e.OnlyControl && e.Character.ToString().ToLower().Equals("e")) { AfterSearchGesture?.Invoke(this, EventArgs.Empty); } else if (e.VirtualKey == Windows.System.VirtualKey.GamepadMenu) { AfterMenuGesture?.Invoke(this, EventArgs.Empty); } else { e.Handled = false; } AfterKeyDown?.Invoke(this, e); } }; }