fixing all warnings and i think i got one larger one that was before stylecop was enabled, OnOpenWindowsUpdate (#5382)

Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
Clint Rutkas
2020-07-31 16:42:24 -07:00
committed by GitHub
parent e03ef0b739
commit c946f10d0c
11 changed files with 110 additions and 54 deletions

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
@@ -603,167 +604,199 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// The retrieved handle identifies the window of the same type that is highest in the Z order. /// The retrieved handle identifies the window of the same type that is highest in the Z order.
/// </summary> /// </summary>
GW_HWNDFIRST = 0, GW_HWNDFIRST = 0,
/// <summary> /// <summary>
/// The retrieved handle identifies the window of the same type that is lowest in the Z order. /// The retrieved handle identifies the window of the same type that is lowest in the Z order.
/// </summary> /// </summary>
GW_HWNDLAST = 1, GW_HWNDLAST = 1,
/// <summary> /// <summary>
/// The retrieved handle identifies the window below the specified window in the Z order. /// The retrieved handle identifies the window below the specified window in the Z order.
/// </summary> /// </summary>
GW_HWNDNEXT = 2, GW_HWNDNEXT = 2,
/// <summary> /// <summary>
/// The retrieved handle identifies the window above the specified window in the Z order. /// The retrieved handle identifies the window above the specified window in the Z order.
/// </summary> /// </summary>
GW_HWNDPREV = 3, GW_HWNDPREV = 3,
/// <summary> /// <summary>
/// The retrieved handle identifies the specified window's owner window, if any. /// The retrieved handle identifies the specified window's owner window, if any.
/// </summary> /// </summary>
GW_OWNER = 4, GW_OWNER = 4,
/// <summary> /// <summary>
/// The retrieved handle identifies the child window at the top of the Z order, if the specified window /// The retrieved handle identifies the child window at the top of the Z order, if the specified window
/// is a parent window. /// is a parent window.
/// </summary> /// </summary>
GW_CHILD = 5, GW_CHILD = 5,
/// <summary> /// <summary>
/// The retrieved handle identifies the enabled popup window owned by the specified window. /// The retrieved handle identifies the enabled popup window owned by the specified window.
/// </summary> /// </summary>
GW_ENABLEDPOPUP = 6 GW_ENABLEDPOPUP = 6,
} }
/// <summary> /// <summary>
/// GetWindowLong index to retrieves the extended window styles. /// GetWindowLong index to retrieves the extended window styles.
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching interop var")]
public const int GWL_EXSTYLE = -20; public const int GWL_EXSTYLE = -20;
/// <summary> /// <summary>
/// The following are the extended window styles /// The following are the extended window styles
/// </summary> /// </summary>
[Flags] [Flags]
public enum ExtendedWindowStyles : UInt32 public enum ExtendedWindowStyles : uint
{ {
/// <summary> /// <summary>
/// The window has a double border; the window can, optionally, be created with a title bar by specifying /// The window has a double border; the window can, optionally, be created with a title bar by specifying
/// the WS_CAPTION style in the dwStyle parameter. /// the WS_CAPTION style in the dwStyle parameter.
/// </summary> /// </summary>
WS_EX_DLGMODALFRAME = 0X0001, WS_EX_DLGMODALFRAME = 0X0001,
/// <summary> /// <summary>
/// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window /// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window
/// when it is created or destroyed. /// when it is created or destroyed.
/// </summary> /// </summary>
WS_EX_NOPARENTNOTIFY = 0X0004, WS_EX_NOPARENTNOTIFY = 0X0004,
/// <summary> /// <summary>
/// The window should be placed above all non-topmost windows and should stay above all non-topmost windows /// The window should be placed above all non-topmost windows and should stay above all non-topmost windows
/// and should stay above them, even when the window is deactivated. /// and should stay above them, even when the window is deactivated.
/// </summary> /// </summary>
WS_EX_TOPMOST = 0X0008, WS_EX_TOPMOST = 0X0008,
/// <summary> /// <summary>
/// The window accepts drag-drop files. /// The window accepts drag-drop files.
/// </summary> /// </summary>
WS_EX_ACCEPTFILES = 0x0010, WS_EX_ACCEPTFILES = 0x0010,
/// <summary> /// <summary>
/// The window should not be painted until siblings beneath the window (that were created by the same thread) /// The window should not be painted until siblings beneath the window (that were created by the same thread)
/// have been painted. /// have been painted.
/// </summary> /// </summary>
WS_EX_TRANSPARENT = 0x0020, WS_EX_TRANSPARENT = 0x0020,
/// <summary> /// <summary>
/// The window is a MDI child window. /// The window is a MDI child window.
/// </summary> /// </summary>
WS_EX_MDICHILD = 0x0040, WS_EX_MDICHILD = 0x0040,
/// <summary> /// <summary>
/// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter /// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter
/// than a normal title bar, and the window title is drawn using a smaller font. A tool window does not /// than a normal title bar, and the window title is drawn using a smaller font. A tool window does not
/// appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. /// appear in the taskbar or in the dialog that appears when the user presses ALT+TAB.
/// </summary> /// </summary>
WS_EX_TOOLWINDOW = 0x0080, WS_EX_TOOLWINDOW = 0x0080,
/// <summary> /// <summary>
/// The window has a border with a raised edge. /// The window has a border with a raised edge.
/// </summary> /// </summary>
WS_EX_WINDOWEDGE = 0x0100, WS_EX_WINDOWEDGE = 0x0100,
/// <summary> /// <summary>
/// The window has a border with a sunken edge. /// The window has a border with a sunken edge.
/// </summary> /// </summary>
WS_EX_CLIENTEDGE = 0x0200, WS_EX_CLIENTEDGE = 0x0200,
/// <summary> /// <summary>
/// The title bar of the window includes a question mark. /// The title bar of the window includes a question mark.
/// </summary> /// </summary>
WS_EX_CONTEXTHELP = 0x0400, WS_EX_CONTEXTHELP = 0x0400,
/// <summary> /// <summary>
/// The window has generic "right-aligned" properties. This depends on the window class. This style has /// The window has generic "right-aligned" properties. This depends on the window class. This style has
/// an effect only if the shell language supports reading-order alignment, otherwise is ignored. /// an effect only if the shell language supports reading-order alignment, otherwise is ignored.
/// </summary> /// </summary>
WS_EX_RIGHT = 0x1000, WS_EX_RIGHT = 0x1000,
/// <summary> /// <summary>
/// The window has generic left-aligned properties. This is the default. /// The window has generic left-aligned properties. This is the default.
/// </summary> /// </summary>
WS_EX_LEFT = 0x0, WS_EX_LEFT = 0x0,
/// <summary> /// <summary>
/// If the shell language supports reading-order alignment, the window text is displayed using right-to-left /// If the shell language supports reading-order alignment, the window text is displayed using right-to-left
/// reading-order properties. For other languages, the styles is ignored. /// reading-order properties. For other languages, the styles is ignored.
/// </summary> /// </summary>
WS_EX_RTLREADING = 0x2000, WS_EX_RTLREADING = 0x2000,
/// <summary> /// <summary>
/// The window text is displayed using left-to-right reading-order properties. This is the default. /// The window text is displayed using left-to-right reading-order properties. This is the default.
/// </summary> /// </summary>
WS_EX_LTRREADING = 0x0, WS_EX_LTRREADING = 0x0,
/// <summary> /// <summary>
/// If the shell language supports reading order alignment, the vertical scroll bar (if present) is to /// If the shell language supports reading order alignment, the vertical scroll bar (if present) is to
/// the left of the client area. For other languages, the style is ignored. /// the left of the client area. For other languages, the style is ignored.
/// </summary> /// </summary>
WS_EX_LEFTSCROLLBAR = 0x4000, WS_EX_LEFTSCROLLBAR = 0x4000,
/// <summary> /// <summary>
/// The vertical scroll bar (if present) is to the right of the client area. This is the default. /// The vertical scroll bar (if present) is to the right of the client area. This is the default.
/// </summary> /// </summary>
WS_EX_RIGHTSCROLLBAR = 0x0, WS_EX_RIGHTSCROLLBAR = 0x0,
/// <summary> /// <summary>
/// The window itself contains child windows that should take part in dialog box, navigation. If this /// The window itself contains child windows that should take part in dialog box, navigation. If this
/// style is specified, the dialog manager recurses into children of this window when performing /// style is specified, the dialog manager recurses into children of this window when performing
/// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic. /// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic.
/// </summary> /// </summary>
WS_EX_CONTROLPARENT = 0x10000, WS_EX_CONTROLPARENT = 0x10000,
/// <summary> /// <summary>
/// The window has a three-dimensional border style intended to be used for items that do not accept /// The window has a three-dimensional border style intended to be used for items that do not accept
/// user input. /// user input.
/// </summary> /// </summary>
WS_EX_STATICEDGE = 0x20000, WS_EX_STATICEDGE = 0x20000,
/// <summary> /// <summary>
/// Forces a top-level window onto the taskbar when the window is visible. /// Forces a top-level window onto the taskbar when the window is visible.
/// </summary> /// </summary>
WS_EX_APPWINDOW = 0x40000, WS_EX_APPWINDOW = 0x40000,
/// <summary> /// <summary>
/// The window is an overlapped window. /// The window is an overlapped window.
/// </summary> /// </summary>
WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE,
/// <summary> /// <summary>
/// The window is palette window, which is a modeless dialog box that presents an array of commands. /// The window is palette window, which is a modeless dialog box that presents an array of commands.
/// </summary> /// </summary>
WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
/// <summary> /// <summary>
/// The window is a layered window. This style cannot be used if the window has a class style of either /// The window is a layered window. This style cannot be used if the window has a class style of either
/// CS_OWNDC or CS_CLASSDC. Only for top level window before Windows 8, and child windows from Windows 8. /// CS_OWNDC or CS_CLASSDC. Only for top level window before Windows 8, and child windows from Windows 8.
/// </summary> /// </summary>
WS_EX_LAYERED = 0x80000, WS_EX_LAYERED = 0x80000,
/// <summary> /// <summary>
/// The window does not pass its window layout to its child windows. /// The window does not pass its window layout to its child windows.
/// </summary> /// </summary>
WS_EX_NOINHERITLAYOUT = 0x100000, WS_EX_NOINHERITLAYOUT = 0x100000,
/// <summary> /// <summary>
/// If the shell language supports reading order alignment, the horizontal origin of the window is on the /// If the shell language supports reading order alignment, the horizontal origin of the window is on the
/// right edge. Increasing horizontal values advance to the left. /// right edge. Increasing horizontal values advance to the left.
/// </summary> /// </summary>
WS_EX_LAYOUTRTL = 0x400000, WS_EX_LAYOUTRTL = 0x400000,
/// <summary> /// <summary>
/// Paints all descendants of a window in bottom-to-top painting order using double-buffering. /// Paints all descendants of a window in bottom-to-top painting order using double-buffering.
/// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and /// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and
/// transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT /// transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT
/// bit set. Double-buffering allows the window and its descendents to be painted without flicker. /// bit set. Double-buffering allows the window and its descendents to be painted without flicker.
/// </summary> /// </summary>
WS_EX_COMPOSITED = 0x2000000, WS_EX_COMPOSITED = 0x2000000,
/// <summary> /// <summary>
/// A top-level window created with this style does not become the foreground window when the user /// A top-level window created with this style does not become the foreground window when the user
/// clicks it. The system does not bring this window to the foreground when the user minimizes or closes /// clicks it. The system does not bring this window to the foreground when the user minimizes or closes
/// the foreground window. /// the foreground window.
/// </summary> /// </summary>
WS_EX_NOACTIVATE = 0x8000000 WS_EX_NOACTIVATE = 0x8000000,
} }
[DllImport("user32.dll", CharSet = CharSet.Unicode)] [DllImport("user32.dll", CharSet = CharSet.Unicode)]

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System; using System;
namespace Microsoft.Plugin.WindowWalker.Components namespace Microsoft.Plugin.WindowWalker.Components

View File

@@ -1,11 +1,10 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.Plugin.WindowWalker.Components namespace Microsoft.Plugin.WindowWalker.Components
{ {
@@ -22,7 +21,11 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <summary> /// <summary>
/// Event raised when there is an update to the list of open windows /// Event raised when there is an update to the list of open windows
/// </summary> /// </summary>
public event OpenWindowsUpdateHandler OnOpenWindowsUpdate; public event OpenWindowsUpdateHandler OnOpenWindowsUpdate
{
add { }
remove { }
}
/// <summary> /// <summary>
/// List of all the open windows /// List of all the open windows

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -95,15 +96,15 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// </summary> /// </summary>
public async Task UpdateSearchText(string searchText) public async Task UpdateSearchText(string searchText)
{ {
this.SearchText = searchText; SearchText = searchText;
await SyncOpenWindowsWithModelAsync(); await SyncOpenWindowsWithModelAsync();
} }
/// <summary> /// <summary>
/// Event handler called when the OpenWindows list changes /// Event handler called when the OpenWindows list changes
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender">sending item</param>
/// <param name="e"></param> /// <param name="e">event arg</param>
public async void OpenWindowsUpdateHandler(object sender, SearchResultUpdateEventArgs e) public async void OpenWindowsUpdateHandler(object sender, SearchResultUpdateEventArgs e)
{ {
await SyncOpenWindowsWithModelAsync(); await SyncOpenWindowsWithModelAsync();
@@ -133,7 +134,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <summary> /// <summary>
/// Redirecting method for Fuzzy searching /// Redirecting method for Fuzzy searching
/// </summary> /// </summary>
/// <param name="openWindows"></param> /// <param name="openWindows">what windows are open</param>
/// <returns>Returns search results</returns> /// <returns>Returns search results</returns>
private Task<List<SearchResult>> FuzzySearchOpenWindowsAsync(List<Window> openWindows) private Task<List<SearchResult>> FuzzySearchOpenWindowsAsync(List<Window> openWindows)
{ {
@@ -145,7 +146,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <summary> /// <summary>
/// Search method that matches the title of windows with the user search text /// Search method that matches the title of windows with the user search text
/// </summary> /// </summary>
/// <param name="openWindows"></param> /// <param name="openWindows">what windows are open</param>
/// <returns>Returns search results</returns> /// <returns>Returns search results</returns>
private List<SearchResult> FuzzySearchOpenWindows(List<Window> openWindows) private List<SearchResult> FuzzySearchOpenWindows(List<Window> openWindows)
{ {

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System.Collections.Generic; using System.Collections.Generic;
namespace Microsoft.Plugin.WindowWalker.Components namespace Microsoft.Plugin.WindowWalker.Components

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
namespace Microsoft.Plugin.WindowWalker.Components namespace Microsoft.Plugin.WindowWalker.Components
{ {
/// <summary> /// <summary>
@@ -34,8 +35,8 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// Initializes a new instance of the <see cref="SearchString"/> class. /// Initializes a new instance of the <see cref="SearchString"/> class.
/// Constructor /// Constructor
/// </summary> /// </summary>
/// <param name="searchText"></param> /// <param name="searchText">text from search</param>
/// <param name="searchType"></param> /// <param name="searchType">type of search</param>
public SearchString(string searchText, SearchResult.SearchType searchType) public SearchString(string searchText, SearchResult.SearchType searchType)
{ {
SearchText = searchText; SearchText = searchText;

View File

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ // See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@@ -112,7 +113,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
InteropAndHelpers.CallBackPtr callbackptr = new InteropAndHelpers.CallBackPtr((IntPtr hwnd, IntPtr lParam) => InteropAndHelpers.CallBackPtr callbackptr = new InteropAndHelpers.CallBackPtr((IntPtr hwnd, IntPtr lParam) =>
{ {
var childProcessId = GetProcessIDFromWindowHandle(hwnd); var childProcessId = GetProcessIDFromWindowHandle(hwnd);
if (childProcessId != this.ProcessID) if (childProcessId != ProcessID)
{ {
_handlesToProcessCache[Hwnd] = GetProcessNameFromWindowHandle(hwnd); _handlesToProcessCache[Hwnd] = GetProcessNameFromWindowHandle(hwnd);
return false; return false;
@@ -191,7 +192,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
} }
/// <summary> /// <summary>
/// Determines whether the specified window handle identifies an existing window. /// Gets a value indicating whether determines whether the specified window handle identifies an existing window.
/// </summary> /// </summary>
public bool IsWindow public bool IsWindow
{ {
@@ -202,7 +203,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
} }
/// <summary> /// <summary>
/// Get a value indicating whether is the window GWL_EX_STYLE is a toolwindow /// Gets a value indicating whether get a value indicating whether is the window GWL_EX_STYLE is a toolwindow
/// </summary> /// </summary>
public bool IsToolWindow public bool IsToolWindow
{ {
@@ -215,7 +216,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
} }
/// <summary> /// <summary>
/// Get a value indicating whether the window GWL_EX_STYLE is an appwindow /// Gets a value indicating whether get a value indicating whether the window GWL_EX_STYLE is an appwindow
/// </summary> /// </summary>
public bool IsAppWindow public bool IsAppWindow
{ {
@@ -228,7 +229,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
} }
/// <summary> /// <summary>
/// Get a value indicating whether the window has ITaskList_Deleted property /// Gets a value indicating whether get a value indicating whether the window has ITaskList_Deleted property
/// </summary> /// </summary>
public bool TaskListDeleted public bool TaskListDeleted
{ {
@@ -239,18 +240,18 @@ namespace Microsoft.Plugin.WindowWalker.Components
} }
/// <summary> /// <summary>
/// Get a value indicating whether the app is a cloaked UWP app /// Gets a value indicating whether get a value indicating whether the app is a cloaked UWP app
/// </summary> /// </summary>
public bool IsUWPCloaked public bool IsUWPCloaked
{ {
get get
{ {
return (this.IsWindowCloaked() && this.ClassName == "ApplicationFrameWindow"); return IsWindowCloaked() && ClassName == "ApplicationFrameWindow";
} }
} }
/// <summary> /// <summary>
/// Determines whether the specified windows is the owner /// Gets a value indicating whether determines whether the specified windows is the owner
/// </summary> /// </summary>
public bool IsOwner public bool IsOwner
{ {
@@ -267,7 +268,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
{ {
int isCloaked = 0; int isCloaked = 0;
const int DWMWA_CLOAKED = 14; const int DWMWA_CLOAKED = 14;
InteropAndHelpers.DwmGetWindowAttribute(this.hwnd, DWMWA_CLOAKED, out isCloaked, sizeof(int)); InteropAndHelpers.DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, out isCloaked, sizeof(int));
return isCloaked != 0; return isCloaked != 0;
} }

View File

@@ -1,12 +1,10 @@
using System; // Copyright (c) Microsoft Corporation
using System.Collections.Generic; // The Microsoft Corporation licenses this file to you under the MIT license.
using System.Linq; // See the LICENSE file in the project root for more information.
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Plugin.WindowWalker.Components namespace Microsoft.Plugin.WindowWalker.Components
{ {
class WindowResult : Window internal class WindowResult : Window
{ {
/// <summary> /// <summary>
/// Number of letters in between constant for when /// Number of letters in between constant for when
@@ -15,21 +13,19 @@ namespace Microsoft.Plugin.WindowWalker.Components
public const int NoResult = -1; public const int NoResult = -1;
/// <summary> /// <summary>
/// Properties that signify how many characters (including spaces) /// Gets or sets properties that signify how many characters (including spaces)
/// were found when matching the results /// were found when matching the results
/// </summary> /// </summary>
public int LettersInBetweenScore public int LettersInBetweenScore { get; set; }
{
get;
set;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="WindowResult"/> class.
/// Constructor for WindowResult /// Constructor for WindowResult
/// </summary> /// </summary>
public WindowResult(Window window) : base(window.Hwnd) public WindowResult(Window window)
: base(window.Hwnd)
{ {
LettersInBetweenScore = WindowResult.NoResult; LettersInBetweenScore = NoResult;
} }
} }
} }

View File

@@ -1,4 +1,8 @@
using System.Collections.Generic; // Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Plugin.WindowWalker.Components; using Microsoft.Plugin.WindowWalker.Components;
using Wox.Plugin; using Wox.Plugin;
@@ -8,7 +12,9 @@ namespace Microsoft.Plugin.WindowWalker
public class Main : IPlugin, IPluginI18n public class Main : IPlugin, IPluginI18n
{ {
private static List<SearchResult> _results = new List<SearchResult>(); private static List<SearchResult> _results = new List<SearchResult>();
private string IconPath { get; set; } private string IconPath { get; set; }
private PluginInitContext Context { get; set; } private PluginInitContext Context { get; set; }
static Main() static Main()
@@ -30,9 +36,8 @@ namespace Microsoft.Plugin.WindowWalker
{ {
x.Result.SwitchToWindow(); x.Result.SwitchToWindow();
return true; return true;
} },
} }).ToList();
).ToList();
} }
public void Init(PluginInitContext context) public void Init(PluginInitContext context)
@@ -55,7 +60,7 @@ namespace Microsoft.Plugin.WindowWalker
} }
} }
private void OnThemeChanged(Theme _, Theme newTheme) private void OnThemeChanged(Theme currentTheme, Theme newTheme)
{ {
UpdateIconPath(newTheme); UpdateIconPath(newTheme);
} }

View File

@@ -58,10 +58,23 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" /> <PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="Mages" Version="1.6.0" />
<PackageReference Include="System.Runtime" Version="4.3.1" /> <PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\codeAnalysis\GlobalSuppressions.cs">
<Link>GlobalSuppressions.cs</Link>
</Compile>
<AdditionalFiles Include="..\..\..\..\codeAnalysis\StyleCop.json">
<Link>StyleCop.json</Link>
</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers">
<Version>1.1.118</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="Images\windowwalker.dark.png"> <None Update="Images\windowwalker.dark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>