public void Inspect(object rootToInspect) { ExceptionHandler.AddExceptionHandler(this.Dispatcher); this.Load(rootToInspect); this.Owner = SnoopWindowUtils.FindOwnerWindow(this); Trace.WriteLine("Showing snoop UI..."); this.Show(); this.Activate(); Trace.WriteLine("Shown and activated snoop UI."); }
public void Magnify(object root) { Target = root; var ownerWindow = SnoopWindowUtils.FindOwnerWindow(); if (ownerWindow != null) { Owner = ownerWindow; } SnoopPartsRegistry.AddSnoopVisualTreeRoot(this); Show(); Activate(); }
public void Inspect() { object localRoot = FindRoot(); if (localRoot == null) { if (!SnoopModes.MultipleDispatcherMode) { //SnoopModes.MultipleDispatcherMode is always false for all scenarios except for cases where we are running multiple dispatchers. //If SnoopModes.MultipleDispatcherMode was set to true, then there definitely was a root visual found in another dispatcher, so //the message below would be wrong. MessageBox.Show ( "Can't find a current application or a PresentationSource root visual!", "Can't Snoop", MessageBoxButton.OK, MessageBoxImage.Exclamation ); } return; } Load(localRoot); Window ownerWindow = SnoopWindowUtils.FindOwnerWindow(); if (ownerWindow != null) { if (ownerWindow.Dispatcher != Dispatcher) { return; } Owner = ownerWindow; // watch for window closing so we can spit out the changed properties ownerWindow.Closing += SnoopedWindowClosingHandler; } SnoopPartsRegistry.AddSnoopVisualTreeRoot(this); Dispatcher.UnhandledException += UnhandledExceptionHandler; Show(); Activate(); }