private void InputManager_PostNotifyInput(object sender, NotifyInputEventArgs e) { if (this.IsPointerButtonEventItem(e.StagingItem)) { this.handlingPointerButtonEvent = false; } }
static void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs args = e.StagingItem.Input as KeyEventArgs; if (args != null) { if (!args.Handled && args.IsDown) { foreach (MenuItem item in MenuItemsWithShortCuts) { if (item != null) { KeyBinding binding = GetShortcut(item); if ((binding != null) && (item.Command != null)) { if (binding.Gesture.Matches(item, args)) { if (item.Command.CanExecute(item.CommandParameter)) { item.Command.Execute(item.CommandParameter); } } } } } } } }
private void InputManager_PreNotifyInput(object sender, NotifyInputEventArgs e) { if (!this.IsPointerButtonEventItem(e.StagingItem)) { return; } this.handlingPointerButtonEvent = true; }
private void MouseManagerPreProcessMouse(object sender, NotifyInputEventArgs e) { var args = e.StagingItem.Input as MouseButtonEventArgs; if (args?.ChangedButton == MouseButton.Left && args.ButtonState == MouseButtonState.Released) { Close(); } }
//// InputManager.Current.PreProcessInput += (o, e) => Dump("PreProcessInput", e); //// InputManager.Current.PostProcessInput += (o, e) => Dump("PostProcessInput", e); #pragma warning disable CS8321 // Local function is declared but never used static void Dump(string name, NotifyInputEventArgs args) #pragma warning restore CS8321 // Local function is declared but never used { if (args.StagingItem.Input is { } inputEventArgs&& inputEventArgs.RoutedEvent.Name != "PreviewInputReport" && inputEventArgs.Device is not KeyboardDevice) { Debug.WriteLine($"{name,-16} {inputEventArgs.GetType().Name,-28} {inputEventArgs.Device?.GetType().Name ?? "null",-21} {inputEventArgs.Device?.Target?.GetType().Name ?? "null",-15} {inputEventArgs.RoutedEvent.Name}"); } }
private void Current_PreNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs == null || !keyEventArgs.IsDown && !keyEventArgs.IsUp) { return; } this.AltKeyDown = (Keyboard.Modifiers & ModifierKeys.Alt) != ModifierKeys.None; }
private void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs == null || keyEventArgs.Key != Key.Escape || !this.isButtonDown) { return; } this.FinishEditing(false); keyEventArgs.Handled = true; }
/// <summary> /// Handles the PreNotifyInput event of the Current control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.NotifyInputEventArgs"/> /// instance containing the event data.</param> void Current_PreNotifyInput(object sender, NotifyInputEventArgs e) { if (e.StagingItem.Input is MouseEventArgs || e.StagingItem.Input is KeyboardEventArgs || e.StagingItem.Input is TextCompositionEventArgs || e.StagingItem.Input is StylusEventArgs) { _lastActivityTime = Environment.TickCount; } else { // The event is an internal event not caused by user intervention } }
private void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { if (this.StopListeningForInputEventsIfNeeded()) { return; } KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs == null || keyEventArgs.Key != Key.Escape || (!keyEventArgs.IsDown || keyEventArgs.Handled) || (this.Child == null || !this.Child.IsMouseCaptured || !this.recievedEscapeOnPreNotifyInput)) { return; } this.IsOpen = false; }
private void Current_PreNotifyInput(object sender, NotifyInputEventArgs e) { if (this.StopListeningForInputEventsIfNeeded()) { return; } KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs == null || keyEventArgs.Key != Key.Escape || !keyEventArgs.IsDown) { return; } this.recievedEscapeOnPreNotifyInput = this.Child != null && this.Child.IsMouseCaptured && !this.IsKeyboardFocusWithin; }
void inputManager_PreNotifyInput(object sender, NotifyInputEventArgs e) { if (e.StagingItem.Input.RoutedEvent == PreviewRawInputEvent) { RawMultitouchReport report = e.StagingItem.Input as RawMultitouchReport; if (report != null && !report.Handled) { report.Context.OverElement = GetTargetElement(report.Context.Contact.Position, report.Context.Root, report); Contact contact; if (!report.CleanUp) { if (ContactsManager.ExistingContacts.TryGetValue(report.Context.Contact.Id, out contact)) { contact.InputArgs = report; } else { contact = new Contact(report); ContactsManager.ExistingContacts[report.Context.Contact.Id] = contact; } } else { contact = ContactsManager.ExistingContacts[report.Context.Contact.Id]; contact.InputArgs = report; report.Handled = true; } UIElementsList mergedList; report.Context.ElementsList = BuildElementsList(report, report.Context.OverElement, report.Context.ElementsList, out mergedList); if (mergedList != null) { RaiseEnterLeave(contact, mergedList); } if (report.CleanUp) { if (report.Captured != null) { contact.Capture(null); } ContactsManager.ExistingContacts.Remove(contact.Id); } } } Debug.Assert(e.StagingItem.Input.RoutedEvent != null, "routed event null"); }
private void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs != null && keyEventArgs.Key == Key.Escape && this.state != null) { this.CancelEditing(); } else { if (!(e.StagingItem.Input is MouseEventArgs)) { return; } this.state.OnMouseMovement(); } }
private void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs != null && keyEventArgs.Key == Key.Escape && this.isEditing) { this.CancelEditing(); } else { if (this.aboutToCommit || !(e.StagingItem.Input is MouseEventArgs) || !this.isEditing) { return; } this.UpdateOnMouseEvent(); } }
private void PreNotifyInput(object sender, NotifyInputEventArgs e) { // I'm only interested in key down events if (e.StagingItem.Input.RoutedEvent != Keyboard.KeyDownEvent) { return; } var args = e.StagingItem.Input as KeyEventArgs; // I only care about the space key being pressed // you might have to check for other characters if (args == null || args.Key != Key.Space) { return; } // stop event processing here args.Handled = true; // this is my internal method for handling a keystroke HandleKeystroke(" "); }
private void ProcessF5RefreshHotKey(object sender, NotifyInputEventArgs e) { if (OwnedWindows.Count != 0) { return; } if (e.StagingItem.Input.RoutedEvent != Keyboard.KeyDownEvent) { return; } var args = e.StagingItem.Input as KeyEventArgs; if (args == null || args.Key != Key.F5) { return; } args.Handled = true; if (ShowChangesCmd.CanExecute(null)) { ShowChangesCmd.Execute(null); } }
private void Current_PostNotifyInput(object sender, NotifyInputEventArgs e) { KeyEventArgs keyEventArgs = e.StagingItem.Input as KeyEventArgs; if (keyEventArgs != null && keyEventArgs.Key == Key.Escape && this.isCapturing) { this.CancelEditing(); } else { if (!(e.StagingItem.Input is MouseEventArgs)) { return; } UnsafeNativeMethods.Win32Point cursorPosition = UnsafeNativeMethods.GetCursorPosition(); if (this.lastX == cursorPosition.x && this.lastY == cursorPosition.y) { return; } this.lastX = cursorPosition.x; this.lastY = cursorPosition.y; this.StartUpdateColor(cursorPosition.x, cursorPosition.y); } }