Move focus to main window of process if it's already running (using ProcessAddin)#60
Open
jonstodle wants to merge 11 commits into
Open
Move focus to main window of process if it's already running (using ProcessAddin)#60jonstodle wants to merge 11 commits into
jonstodle wants to merge 11 commits into
Conversation
reinismu
reviewed
Jan 26, 2018
| { | ||
| var results = Process.GetProcesses() | ||
| .Where(process => process.MainWindowTitle.IndexOf(query.Raw, StringComparison.OrdinalIgnoreCase) >= 0) | ||
| .Select(process => (IQueryResult) new ProcessResult(process.Id, process.MainWindowTitle, process.ProcessName, LevenshteinScorer.Score(process.MainWindowTitle, query.Raw, false), LevenshteinScorer.Score(process.MainWindowTitle, query.Raw))) |
reinismu
reviewed
Jan 26, 2018
| .Select(process => (IQueryResult) new ProcessResult(process.Id, process.MainWindowTitle, process.ProcessName, LevenshteinScorer.Score(process.MainWindowTitle, query.Raw, false), LevenshteinScorer.Score(process.MainWindowTitle, query.Raw))) | ||
| .ToList(); | ||
|
|
||
| return results.AsEnumerable(); |
There was a problem hiding this comment.
Can simplify by removing results variable
reinismu
reviewed
Jan 26, 2018
|
|
||
| var rect = new Win32.W32Rect(); | ||
| Win32.Window.GetWindowRect(process.MainWindowHandle, ref rect); | ||
| if (rect.Top < 0 && rect.Right < 0 && rect.Bottom < 0 && rect.Left < 0) // Window is minimized |
There was a problem hiding this comment.
I think it can be replaced with https://msdn.microsoft.com/en-us/library/windows/desktop/ms633527(v=vs.85).aspx
reinismu
reviewed
Jan 26, 2018
| return Task.FromResult(null as ImageSource); | ||
| } | ||
|
|
||
| public override Task<IEnumerable<IQueryResult>> QueryAsync(Query query) |
There was a problem hiding this comment.
How is the speed using C# Process class, when I was testing it got pretty slow
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After having difficulty getting #49 to work i propose this alternative solution. Using an addin to query the currently running processes and provide them as query results.
This still needs some work regarding UWP processes, as it currently includes the background processes of UWP apps.
This closes #38, #49