Пример #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
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            // load the window placement details from the user settings.
            SnoopWindowUtils.LoadWindowPlacement(this, Properties.Settings.Default.AppChooserWindowPlacement);
        }
Пример #3
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));
        }
Пример #4
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            // persist the window placement details to the user settings.
            SnoopWindowUtils.SaveWindowPlacement(this, wp => Properties.Settings.Default.AppChooserWindowPlacement = wp);

            Properties.Settings.Default.Save();
        }
Пример #5
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            this.Viewbox.Child = null;

            // persist the window placement details to the user settings.
            SnoopWindowUtils.SaveWindowPlacement(this, wp => Properties.Settings.Default.ZoomerWindowPlacement = wp);

            SnoopPartsRegistry.RemoveSnoopVisualTreeRoot(this);
        }
Пример #6
0
        public void Magnify(object root)
        {
            this.Target = root;

            this.Owner = SnoopWindowUtils.FindOwnerWindow(this);

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            this.Show();
            this.Activate();
        }
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            this.keyboardHook = new LowLevelKeyboardHook(PresentationSource.FromVisual(this));
            this.keyboardHook.LowLevelKeyUp += KeyboardHook_LowLevelKeyUp;
            this.keyboardHook.Start();

            // load the window placement details from the user settings.
            SnoopWindowUtils.LoadWindowPlacement(this, Settings.Default.AppChooserWindowPlacement);
        }
Пример #8
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            // load whether all properties are shown by default
            this.PropertyGrid.ShowDefaults = Properties.Settings.Default.ShowDefaults;

            // load whether the previewer is shown by default
            this.PreviewArea.IsActive = Properties.Settings.Default.ShowPreviewer;

            // load the window placement details from the user settings.
            SnoopWindowUtils.LoadWindowPlacement(this, Properties.Settings.Default.SnoopUIWindowPlacement);
        }
Пример #9
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();
        }
Пример #10
0
        public void Magnify(object root)
        {
            Target = root;

            var ownerWindow = SnoopWindowUtils.FindOwnerWindow();

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

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            Show();
            Activate();
        }
Пример #11
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();
        }
Пример #12
0
        /// <summary>
        /// Cleanup when closing the window.
        /// </summary>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            this.CurrentSelection = null;

            InputManager.Current.PreProcessInput -= this.HandlePreProcessInput;
            EventsListener.Stop();

            // persist the window placement details to the user settings.
            SnoopWindowUtils.SaveWindowPlacement(this, wp => Properties.Settings.Default.SnoopUIWindowPlacement = wp);

            // persist whether all properties are shown by default
            Properties.Settings.Default.ShowDefaults = this.PropertyGrid.ShowDefaults;

            // persist whether the previewer is shown by default
            Properties.Settings.Default.ShowPreviewer = this.PreviewArea.IsActive;

            // actually do the persisting
            Properties.Settings.Default.Save();

            SnoopPartsRegistry.RemoveSnoopVisualTreeRoot(this);
        }