public void Refresh()
        {
            this.windows.Clear();

            Dispatcher.BeginInvoke
            (
                System.Windows.Threading.DispatcherPriority.Loaded,
                (DispatcherOperationCallback)delegate
                {
                    try
                    {
                        Mouse.OverrideCursor = Cursors.Wait;

                        foreach (IntPtr windowHandle in NativeMethods.ToplevelWindows)
                        {
                            TMWindowInfo window = new TMWindowInfo(windowHandle);
                            if (window.IsValidProcess && !this.HasProcess(window.OwningProcess))
                            {
                                new TMAttachFailedHandler(window, this);
                                this.windows.Add(window);
                            }
                        }

                        if (this.windows.Count > 0)
                            this.windowsView.MoveCurrentTo(this.windows[0]);
                    }
                    finally
                    {
                        Mouse.OverrideCursor = null;
                    }
                    return null;
                },
                null
            );
        }
Пример #2
0
        private void HandleInspectCommand(object sender, ExecutedRoutedEventArgs e)
        {
            TMWindowInfo window = (TMWindowInfo)this.windowsView.CurrentItem;

            if (window != null)
            {
                window.Snoop();
            }
        }
Пример #3
0
        public void Refresh()
        {
            this.windows.Clear();

            Dispatcher.BeginInvoke
            (
                System.Windows.Threading.DispatcherPriority.Loaded,
                (DispatcherOperationCallback) delegate
            {
                try
                {
                    Mouse.OverrideCursor = Cursors.Wait;

                    foreach (IntPtr windowHandle in NativeMethods.ToplevelWindows)
                    {
                        TMWindowInfo window = new TMWindowInfo(windowHandle);
                        if (window.IsValidProcess && !this.HasProcess(window.OwningProcess))
                        {
                            new TMAttachFailedHandler(window, this);
                            this.windows.Add(window);
                        }
                    }

                    if (this.windows.Count > 0)
                    {
                        this.windowsView.MoveCurrentTo(this.windows[0]);
                    }
                }
                finally
                {
                    Mouse.OverrideCursor = null;
                }
                return(null);
            },
                null
            );
        }
Пример #4
0
 public TMAttachFailedHandler(TMWindowInfo window, AppChooserExperience appChooserExperience = null)
 {
     window.AttachFailed  += OnSnoopAttachFailed;
     _appChooserExperience = appChooserExperience;
 }
Пример #5
0
 private void HandleRefreshCommand(object sender, ExecutedRoutedEventArgs e)
 {
     // clear out cached process info to make the force refresh do the process check over again.
     TMWindowInfo.ClearCachedProcessInfo();
     this.Refresh();
 }
 public TMAttachFailedHandler(TMWindowInfo window, AppChooserExperience appChooserExperience = null)
 {
     window.AttachFailed += OnSnoopAttachFailed;
     _appChooserExperience = appChooserExperience;
 }