Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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();
        }
Esempio n. 10
0
        public void Magnify(object root)
        {
            Target = root;

            var ownerWindow = SnoopWindowUtils.FindOwnerWindow();

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

            SnoopPartsRegistry.AddSnoopVisualTreeRoot(this);

            Show();
            Activate();
        }
Esempio n. 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();
        }
Esempio n. 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);
        }