Snoop.SnoopUI.Inspect C# (CSharp) Method

Inspect() public method

public Inspect ( ) : void
return void
        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);

            Window ownerWindow = SnoopWindowUtils.FindOwnerWindow();
            if (ownerWindow != null)
            {
                if (ownerWindow.Dispatcher != this.Dispatcher)
                {
                    return;
                }
                this.Owner = ownerWindow;
            }

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

            Show();
            Activate();
        }

Same methods

SnoopUI::Inspect ( object root, Window ownerWindow ) : void

Usage Example

Exemplo n.º 1
0
        public static void SnoopApplication()
        {
            Dispatcher dispatcher;

            if (Application.Current == null)
            {
                dispatcher = Dispatcher.CurrentDispatcher;
            }
            else
            {
                dispatcher = Application.Current.Dispatcher;
            }

            if (dispatcher.CheckAccess())
            {
                SnoopUI snoop = new SnoopUI();
                var     title = TryGetMainWindowTitle();
                if (!string.IsNullOrEmpty(title))
                {
                    snoop.Title = string.Format("{0} - Snoop", title);
                }

                snoop.Inspect();

                CheckForOtherDispatchers(dispatcher);
            }
            else
            {
                dispatcher.Invoke((Action)SnoopApplication);
                return;
            }
        }
All Usage Examples Of Snoop.SnoopUI::Inspect