private static void DispatchOut(object o) { List <Visual> visuals = (List <Visual>)o; foreach (var visual in visuals) { visual.Dispatcher.Invoke(() => { var snoopOtherDispatcher = new SnoopUI(); snoopOtherDispatcher.Inspect(visual, visual as Window); }); } }
public static void SnoopApplication() { var dispatcher = Application.Current == null ? Dispatcher.CurrentDispatcher : Application.Current.Dispatcher; if (dispatcher.CheckAccess()) { SnoopUI snoop = new SnoopUI(); var title = TryGetMainWindowTitle(); if (!string.IsNullOrEmpty(title)) { snoop.Title = string.Format("{0} - SnoopX", title); } snoop.Inspect(); CheckForOtherDispatchers(dispatcher); } else { dispatcher.Invoke(SnoopApplication); } }