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;
 }