void HandleEventHandled(TrackedEvent trackedEvent) { var visual = trackedEvent.Originator.Handler as Visual; if (visual != null && !visual.IsPartOfSnoopVisualTree()) { Action action = () => { interestingEvents.Add(trackedEvent); while (interestingEvents.Count > 100) { interestingEvents.RemoveAt(0); } var tvi = (TreeViewItem)EventTree.ItemContainerGenerator.ContainerFromItem(trackedEvent); if (tvi != null) { tvi.BringIntoView(); } }; if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke(action); } else { action.Invoke(); } } }
private void HandleEventHandled(TrackedEvent trackedEvent) { Visual visual = trackedEvent.Originator.Handler as Visual; if (visual != null && !visual.IsPartOfSnoopVisualTree()) { Action action = () => { this.interestingEvents.Add(trackedEvent); while (this.interestingEvents.Count > 100) this.interestingEvents.RemoveAt(0); TreeViewItem tvi = (TreeViewItem)this.EventTree.ItemContainerGenerator.ContainerFromItem(trackedEvent); if (tvi != null) tvi.BringIntoView(); }; if (!this.Dispatcher.CheckAccess()) { this.Dispatcher.BeginInvoke(action); } else { action.Invoke(); } } }
void HandleEvent(object sender, RoutedEventArgs e) { // Try to figure out what element handled the event. Not precise. if (isEnabled) { var entry = new EventEntry(sender, e.Handled); if (currentEvent != null && currentEvent.EventArgs == e) { currentEvent.AddEventEntry(entry); } else { currentEvent = new TrackedEvent(e, entry); EventHandled(currentEvent); } } }
private void HandleEvent(object sender, RoutedEventArgs e) { // Try to figure out what element handled the event. Not precise. if (this.isEnabled) { EventEntry entry = new EventEntry(sender, e.Handled); if (this.currentEvent != null && this.currentEvent.EventArgs == e) { this.currentEvent.AddEventEntry(entry); } else { this.currentEvent = new TrackedEvent(e, entry); this.EventHandled(this.currentEvent); } } }