예제 #1
0
        public void Inspect()
        {
            object root = FindRoot();

            if (root == 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(root);

            this.Owner = SnoopWindowUtils.FindOwnerWindow(this);

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);
            this.Dispatcher.UnhandledException += new DispatcherUnhandledExceptionEventHandler(UnhandledExceptionHandler);

            Show();
            Activate();
        }
예제 #2
0
        public void Inspect()
        {
            var foundRoot = this.FindRoot();

            if (foundRoot == 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;
            }

            this.Inspect(foundRoot, SnoopWindowUtils.FindOwnerWindow(this));
        }
예제 #3
0
        public void Magnify(object root)
        {
            this.Target = root;

            this.Owner = SnoopWindowUtils.FindOwnerWindow(this);

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            this.Show();
            this.Activate();
        }
예제 #4
0
        public void Inspect(object rootToInspect)
        {
            this.Dispatcher.UnhandledException += this.UnhandledExceptionHandler;

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            this.Load(rootToInspect);

            this.Owner = SnoopWindowUtils.FindOwnerWindow(this);

            this.Show();
            this.Activate();
        }
예제 #5
0
        public void Magnify(object root)
        {
            Target = root;

            var ownerWindow = SnoopWindowUtils.FindOwnerWindow();

            if (ownerWindow != null)
            {
                Owner = ownerWindow;
            }

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            Show();
            Activate();
        }
예제 #6
0
        public void Inspect()
        {
            var root = FindRoot();

            if (root == 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(root);

            var 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();
        }