[PT Run] WindowWalker: Refactor code, fix some bugs, hide UWP non-windows, prepare code for new features (#15441)

* Import files from old PR #15329

* Improvements

* hide uwp non-windows (#13637)

* update debug tool tip

* fix spelling and comments

* disable tool tip

* fix doc links

* remove obsolete using

* Update docs

* fix spelling

* rename elevation property and test method

* Add property <DoesExist> to WindowProcess class

* Close process handles correctly if not used anymore

* cleanup coed

* fix bug with sticky notes process

* add window class to tool tip

* small change

* make nativeMethods static class

* fix broken uwpApp property of WindowProcess class

* rename method

* Revert making NativeMethods class static. It contains instance members.

* improve loggign

* fix merge mistakes

* fixes

* remove obsolete delegate

* Improve SearchController to speed up search (#15561)

* add <IsShellProcess> property to <WindowProcess> class

* reorder code

* disable debug tool tip

* Update devdocs

* remove obsolete event handler

* update var name
This commit is contained in:
Heiko
2022-01-25 10:33:40 +01:00
committed by GitHub
parent 5eaf60e8a2
commit edc43e39ca
8 changed files with 429 additions and 156 deletions

View File

@@ -13,8 +13,6 @@ namespace Microsoft.Plugin.WindowWalker
{
public class Main : IPlugin, IPluginI18n
{
private static List<SearchResult> _results = new List<SearchResult>();
private string IconPath { get; set; }
private PluginInitContext Context { get; set; }
@@ -25,7 +23,6 @@ namespace Microsoft.Plugin.WindowWalker
static Main()
{
SearchController.Instance.OnSearchResultUpdateEventHandler += SearchResultUpdated;
OpenWindows.Instance.UpdateOpenWindowsList();
}
@@ -37,18 +34,22 @@ namespace Microsoft.Plugin.WindowWalker
}
OpenWindows.Instance.UpdateOpenWindowsList();
SearchController.Instance.UpdateSearchText(query.Search).Wait();
SearchController.Instance.UpdateSearchText(query.Search);
List<SearchResult> searchControllerResults = SearchController.Instance.SearchMatches;
return _results.Select(x => new Result()
return searchControllerResults.Select(x => new Result()
{
Title = x.Result.Title,
IcoPath = IconPath,
SubTitle = Properties.Resources.wox_plugin_windowwalker_running + ": " + x.Result.ProcessName,
SubTitle = Properties.Resources.wox_plugin_windowwalker_running + ": " + x.Result.ProcessInfo.Name,
Action = c =>
{
x.Result.SwitchToWindow();
return true;
},
// For debugging you can remove the comment sign in the next line.
// ToolTipData = new ToolTipData(x.Result.Title, $"hWnd: {x.Result.Hwnd}\nWindow class: {x.Result.ClassName}\nProcess ID: {x.Result.ProcessInfo.ProcessID}\nThread ID: {x.Result.ProcessInfo.ThreadID}\nProcess: {x.Result.ProcessInfo.Name}\nProcess exists: {x.Result.ProcessInfo.DoesExist}\nIs full access denied: {x.Result.ProcessInfo.IsFullAccessDenied}\nIs uwp app: {x.Result.ProcessInfo.IsUwpApp}\nIs ShellProcess: {x.Result.ProcessInfo.IsShellProcess}\nIs window cloaked: {x.Result.IsCloaked}\nWindow cloak state: {x.Result.GetWindowCloakState()}"),
}).ToList();
}
@@ -86,10 +87,5 @@ namespace Microsoft.Plugin.WindowWalker
{
return Properties.Resources.wox_plugin_windowwalker_plugin_description;
}
private static void SearchResultUpdated(object sender, SearchController.SearchResultUpdateEventArgs e)
{
_results = SearchController.Instance.SearchMatches;
}
}
}