fixing most whitespace issues, reordering namespaces and adding in headers (#5677)

This commit is contained in:
Clint Rutkas
2020-08-05 14:06:55 -07:00
committed by GitHub
parent 92a2b83bc8
commit ff69f6ed7f
72 changed files with 942 additions and 624 deletions

View File

@@ -1,6 +1,10 @@
using Microsoft.PowerToys.Telemetry; // Copyright (c) Microsoft Corporation
using Microsoft.PowerToys.Telemetry.Events; // 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.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {

View File

@@ -1,4 +1,8 @@
using System.Diagnostics.Tracing; // 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.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
@@ -15,10 +15,11 @@ namespace Microsoft.PowerLauncher.Telemetry
public class LauncherQueryEvent : EventBase, IEvent public class LauncherQueryEvent : EventBase, IEvent
{ {
public double QueryTimeMs { get; set; } public double QueryTimeMs { get; set; }
public int QueryLength { get; set; } public int QueryLength { get; set; }
public int NumResults { get; set; } public int NumResults { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance; public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
} }
} }

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
@@ -14,15 +14,16 @@ namespace Microsoft.PowerLauncher.Telemetry
[EventData] [EventData]
public class LauncherResultActionEvent : EventBase, IEvent public class LauncherResultActionEvent : EventBase, IEvent
{ {
public enum TriggerType public enum TriggerType
{ {
Click, Click,
KeyboardShortcut KeyboardShortcut,
} }
public string Trigger { get; set; } public string Trigger { get; set; }
public string PluginName { get; set; } public string PluginName { get; set; }
public string ActionName { get; set; } public string ActionName { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage; public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {

View File

@@ -2,9 +2,9 @@
// 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. // See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events; using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {

View File

@@ -18,5 +18,19 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" /> <ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" />
</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>
</Project> </Project>

View File

@@ -1,7 +1,10 @@
using System.Windows; // 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.Windows;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Core.Resource; using Wox.Core.Resource;
using Wox.Infrastructure.Exception;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using Wox.Plugin; using Wox.Plugin;

View File

@@ -1,24 +1,24 @@
// 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;
using System.Diagnostics;
using System.Windows;
using ManagedCommon; using ManagedCommon;
using Microsoft.PowerLauncher.Telemetry; using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using System; using PowerLauncher.Helper;
using System.Diagnostics; using PowerLauncher.ViewModel;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using Wox; using Wox;
using Wox.Core;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Core.Resource; using Wox.Core.Resource;
using PowerLauncher.Helper;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Infrastructure.Http; using Wox.Infrastructure.Http;
using Wox.Infrastructure.Image; using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger; using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using Wox.Plugin; using Wox.Plugin;
using PowerLauncher.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch; using Stopwatch = Wox.Infrastructure.Stopwatch;
namespace PowerLauncher namespace PowerLauncher
@@ -26,6 +26,7 @@ namespace PowerLauncher
public partial class App : IDisposable, ISingleInstanceApp public partial class App : IDisposable, ISingleInstanceApp
{ {
public static PublicAPIInstance API { get; private set; } public static PublicAPIInstance API { get; private set; }
private const string Unique = "PowerLauncher_Unique_Application_Mutex"; private const string Unique = "PowerLauncher_Unique_Application_Mutex";
private static bool _disposed = false; private static bool _disposed = false;
private static int _powerToysPid; private static int _powerToysPid;
@@ -66,7 +67,6 @@ namespace PowerLauncher
} }
finally finally
{ {
Environment.Exit(0); Environment.Exit(0);
} }
}); });
@@ -122,7 +122,7 @@ namespace PowerLauncher
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
//[Conditional("RELEASE")] // [Conditional("RELEASE")]
// check update every 5 hours // check update every 5 hours
// check updates on startup // check updates on startup
@@ -156,7 +156,6 @@ namespace PowerLauncher
DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException; DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException;
} }
/// <summary> /// <summary>
/// let exception throw as normal is better for Debug /// let exception throw as normal is better for Debug
/// </summary> /// </summary>

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.IO; using System.IO;
using System.Net; using System.Net;
@@ -40,6 +44,7 @@ namespace PowerLauncher.Helper
public override string ContentType public override string ContentType
{ {
get { return m_contentType; } get { return m_contentType; }
set set
{ {
throw new NotSupportedException(); throw new NotSupportedException();
@@ -49,6 +54,7 @@ namespace PowerLauncher.Helper
public override long ContentLength public override long ContentLength
{ {
get { return m_data.Length; } get { return m_data.Length; }
set set
{ {
throw new NotSupportedException(); throw new NotSupportedException();

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Windows.Threading; using System.Windows.Threading;
using NLog; using NLog;
using Wox.Infrastructure; using Wox.Infrastructure;
@@ -22,15 +26,15 @@ namespace PowerLauncher.Helper
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e) public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
{ {
//handle non-ui thread exceptions // handle non-ui thread exceptions
Report((Exception)e?.ExceptionObject); Report((Exception)e?.ExceptionObject);
} }
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{ {
//handle ui thread exceptions // handle ui thread exceptions
Report(e?.Exception); Report(e?.Exception);
//prevent application exist, so the user can copy prompted error info // prevent application exist, so the user can copy prompted error info
e.Handled = true; e.Handled = true;
} }

View File

@@ -1,6 +1,7 @@
using System; // Copyright (c) Microsoft Corporation
using System.Collections.Generic; // The Microsoft Corporation licenses this file to you under the MIT license.
using System.Text; // See the LICENSE file in the project root for more information.
using System.Windows.Input; using System.Windows.Input;
using Wox.Plugin; using Wox.Plugin;

View File

@@ -1,6 +1,10 @@
using PowerLauncher.ViewModel; // 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.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using PowerLauncher.ViewModel;
namespace PowerLauncher.Helper namespace PowerLauncher.Helper
{ {

View File

@@ -1,17 +1,18 @@
using System; // Copyright (c) Microsoft Corporation
using System.Collections; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.IO.Pipes; using System.IO.Pipes;
using System.Runtime.Serialization.Formatters;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading;
using static PowerLauncher.Helper.WindowsInteropHelper; using static PowerLauncher.Helper.WindowsInteropHelper;
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/ // http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/
@@ -99,7 +100,6 @@ namespace PowerLauncher.Helper
XBUTTONDBLCLK = 0x020D, XBUTTONDBLCLK = 0x020D,
MOUSEHWHEEL = 0x020E, MOUSEHWHEEL = 0x020E,
CAPTURECHANGED = 0x0215, CAPTURECHANGED = 0x0215,
ENTERSIZEMOVE = 0x0231, ENTERSIZEMOVE = 0x0231,
@@ -131,7 +131,7 @@ namespace PowerLauncher.Helper
// This is the hard-coded message value used by WinForms for Shell_NotifyIcon. // This is the hard-coded message value used by WinForms for Shell_NotifyIcon.
// It's relatively safe to reuse. // It's relatively safe to reuse.
TRAYMOUSEMESSAGE = 0x800, //WM_USER + 1024 TRAYMOUSEMESSAGE = 0x800, // WM_USER + 1024
APP = 0x8000 APP = 0x8000
} }
@@ -146,7 +146,6 @@ namespace PowerLauncher.Helper
[DllImport("shell32.dll", EntryPoint = "CommandLineToArgvW", CharSet = CharSet.Unicode)] [DllImport("shell32.dll", EntryPoint = "CommandLineToArgvW", CharSet = CharSet.Unicode)]
private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs); private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs);
[DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)] [DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)]
internal static extern IntPtr _LocalFree(IntPtr hMem); internal static extern IntPtr _LocalFree(IntPtr hMem);
@@ -201,7 +200,6 @@ namespace PowerLauncher.Helper
} }
finally finally
{ {
IntPtr p = _LocalFree(argv); IntPtr p = _LocalFree(argv);
// Otherwise LocalFree failed. // Otherwise LocalFree failed.
// Assert.AreEqual(IntPtr.Zero, p); // Assert.AreEqual(IntPtr.Zero, p);
@@ -309,7 +307,6 @@ namespace PowerLauncher.Helper
} }
catch (NotSupportedException) catch (NotSupportedException)
{ {
// The application was clickonce deployed // The application was clickonce deployed
// Clickonce deployed apps cannot receive traditional commandline arguments // Clickonce deployed apps cannot receive traditional commandline arguments
// As a workaround commandline arguments can be written to a shared location before // As a workaround commandline arguments can be written to a shared location before

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
@@ -12,13 +16,13 @@ namespace PowerLauncher.Helper
{ {
public static class WindowsInteropHelper public static class WindowsInteropHelper
{ {
private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style private const int GWL_STYLE = -16; // WPF's Message code for Title Bar's Style
private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu private const int WS_SYSMENU = 0x80000; // WPF's Message code for System Menu
private static IntPtr _hwnd_shell; private static IntPtr _hwnd_shell;
private static IntPtr _hwnd_desktop; private static IntPtr _hwnd_desktop;
//Accessors for shell and desktop handlers // Accessors for shell and desktop handlers
//Will set the variables once and then will return them // Will set the variables once and then will return them
private static IntPtr HWND_SHELL private static IntPtr HWND_SHELL
{ {
get get
@@ -101,19 +105,19 @@ namespace PowerLauncher.Helper
public static bool IsWindowFullscreen() public static bool IsWindowFullscreen()
{ {
//get current active window // get current active window
IntPtr hWnd = NativeMethods.GetForegroundWindow(); IntPtr hWnd = NativeMethods.GetForegroundWindow();
if (hWnd != null && !hWnd.Equals(IntPtr.Zero)) if (hWnd != null && !hWnd.Equals(IntPtr.Zero))
{ {
//if current active window is NOT desktop or shell // if current active window is NOT desktop or shell
if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL))) if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL)))
{ {
StringBuilder sb = new StringBuilder(256); StringBuilder sb = new StringBuilder(256);
_ = NativeMethods.GetClassName(hWnd, sb, sb.Capacity); _ = NativeMethods.GetClassName(hWnd, sb, sb.Capacity);
string windowClass = sb.ToString(); string windowClass = sb.ToString();
//for Win+Tab (Flip3D) // for Win+Tab (Flip3D)
if (windowClass == WINDOW_CLASS_WINTAB) if (windowClass == WINDOW_CLASS_WINTAB)
{ {
return false; return false;
@@ -122,13 +126,13 @@ namespace PowerLauncher.Helper
RECT appBounds; RECT appBounds;
_ = NativeMethods.GetWindowRect(hWnd, out appBounds); _ = NativeMethods.GetWindowRect(hWnd, out appBounds);
//for console (ConsoleWindowClass), we have to check for negative dimensions // for console (ConsoleWindowClass), we have to check for negative dimensions
if (windowClass == WINDOW_CLASS_CONSOLE) if (windowClass == WINDOW_CLASS_CONSOLE)
{ {
return appBounds.Top < 0 && appBounds.Bottom < 0; return appBounds.Top < 0 && appBounds.Bottom < 0;
} }
//for desktop (Progman or WorkerW, depends on the system), we have to check // for desktop (Progman or WorkerW, depends on the system), we have to check
if (windowClass == WINDOW_CLASS_PROGMAN || windowClass == WINDOW_CLASS_WORKERW) if (windowClass == WINDOW_CLASS_PROGMAN || windowClass == WINDOW_CLASS_WORKERW)
{ {
IntPtr hWndDesktop = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr hWndDesktop = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null);
@@ -185,7 +189,6 @@ namespace PowerLauncher.Helper
return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY)); return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY));
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct RECT internal struct RECT
{ {

View File

@@ -1,4 +1,8 @@
using System.Windows.Controls; // 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.Windows.Controls;
namespace PowerLauncher namespace PowerLauncher
{ {

View File

@@ -1,23 +1,25 @@
using Microsoft.PowerLauncher.Telemetry; // Copyright (c) Microsoft Corporation
using Microsoft.PowerToys.Telemetry; // The Microsoft Corporation licenses this file to you under the MIT license.
using PowerLauncher.Helper; // See the LICENSE file in the project root for more information.
using PowerLauncher.ViewModel;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using PowerLauncher.Helper;
using PowerLauncher.ViewModel;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using KeyEventArgs = System.Windows.Input.KeyEventArgs; using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using Screen = System.Windows.Forms.Screen; using Screen = System.Windows.Forms.Screen;
namespace PowerLauncher namespace PowerLauncher
{ {
public partial class MainWindow : IDisposable public partial class MainWindow : IDisposable
{ {
#region Private Fields #region Private Fields
private Settings _settings; private Settings _settings;
private MainViewModel _viewModel; private MainViewModel _viewModel;
@@ -53,6 +55,7 @@ namespace PowerLauncher
} }
} }
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@@ -106,7 +109,7 @@ namespace PowerLauncher
{ {
var resultVM = result as ResultViewModel; var resultVM = result as ResultViewModel;
//This may be null if the tapped item was one of the context buttons (run as admin etc). // This may be null if the tapped item was one of the context buttons (run as admin etc).
if (resultVM != null) if (resultVM != null)
{ {
_viewModel.Results.SelectedItem = resultVM; _viewModel.Results.SelectedItem = resultVM;
@@ -170,7 +173,7 @@ namespace PowerLauncher
{ {
if (_settings.HideWhenDeactivated) if (_settings.HideWhenDeactivated)
{ {
//(this.FindResource("OutroStoryboard") as Storyboard).Begin(); // (this.FindResource("OutroStoryboard") as Storyboard).Begin();
Hide(); Hide();
} }
} }

View File

@@ -259,5 +259,19 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
</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>-->
</Project> </Project>

View File

@@ -1,8 +1,11 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Core.Resource; using Wox.Core.Resource;
@@ -60,7 +63,7 @@ namespace Wox
public void CheckForNewUpdate() public void CheckForNewUpdate()
{ {
//_settingsVM.UpdateApp(); // _settingsVM.UpdateApp();
} }
public void SaveAppAllSettings() public void SaveAppAllSettings()

View File

@@ -1,18 +1,21 @@
using System; // 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;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using PowerLauncher.Helper; using PowerLauncher.Helper;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Infrastructure.Logger;
using System.Windows.Navigation;
using Wox.Infrastructure.Image; using Wox.Infrastructure.Image;
using System.Drawing; using Wox.Infrastructure.Logger;
using System.Windows.Media.Imaging;
namespace PowerLauncher namespace PowerLauncher
{ {

View File

@@ -1,4 +1,8 @@
using System.Windows.Controls; // 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.Windows.Controls;
namespace PowerLauncher namespace PowerLauncher
{ {

View File

@@ -1,7 +1,9 @@
namespace PowerLauncher.Properties // 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.
namespace PowerLauncher.Properties
{ {
// This class allows you to handle specific events on the settings class: // This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed. // The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed. // The PropertyChanged event is raised after a setting's value is changed.
@@ -9,7 +11,6 @@
// The SettingsSaving event is raised before the setting values are saved. // The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings internal sealed partial class Settings
{ {
public Settings() public Settings()
{ {
// // To add event handlers for saving and changing settings, uncomment the lines below: // // To add event handlers for saving and changing settings, uncomment the lines below:

View File

@@ -1,17 +1,17 @@
using System; // Copyright (c) Microsoft Corporation
using System.Collections.Generic; // The Microsoft Corporation licenses this file to you under the MIT license.
using System.Text; // See the LICENSE file in the project root for more information.
using Wox.Plugin;
using Microsoft.PowerToys.Settings.UI.Lib; using System;
using Wox.Infrastructure.UserSettings;
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using Wox.Infrastructure.Hotkey;
using System.Windows.Input;
using Wox.Core.Plugin;
using System.IO; using System.IO;
using System.Threading;
using System.Windows.Input;
using Microsoft.PowerToys.Settings.UI.Lib;
using Wox.Core.Plugin;
using Wox.Infrastructure.Hotkey;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
namespace PowerLauncher namespace PowerLauncher
{ {
@@ -22,6 +22,7 @@ namespace PowerLauncher
private static object _watcherSyncObject = new object(); private static object _watcherSyncObject = new object();
private FileSystemWatcher _watcher; private FileSystemWatcher _watcher;
private Settings _settings; private Settings _settings;
public SettingsWatcher(Settings settings) public SettingsWatcher(Settings settings)
{ {
_settings = settings; _settings = settings;

View File

@@ -1,3 +1,7 @@
// 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; using System;
namespace PowerLauncher.Storage namespace PowerLauncher.Storage
@@ -5,6 +9,7 @@ namespace PowerLauncher.Storage
public class HistoryItem public class HistoryItem
{ {
public string Query { get; set; } public string Query { get; set; }
public DateTime ExecutedDateTime { get; set; } public DateTime ExecutedDateTime { get; set; }
public string GetTimeAgo() public string GetTimeAgo()

View File

@@ -1,8 +1,10 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json;
using Wox.Plugin;
namespace PowerLauncher.Storage namespace PowerLauncher.Storage
{ {

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 Newtonsoft.Json; using Newtonsoft.Json;
using Wox.Plugin; using Wox.Plugin;
@@ -48,11 +52,12 @@ namespace PowerLauncher.Storage
} }
} }
public class Record public class Record
{ {
public string Title { get; set; } public string Title { get; set; }
public string SubTitle { get; set; } public string SubTitle { get; set; }
public string PluginID { get; set; } public string PluginID { get; set; }
} }
} }

View File

@@ -1,7 +1,10 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using Wox.Plugin; using Wox.Plugin;
namespace PowerLauncher.Storage namespace PowerLauncher.Storage

View File

@@ -1,8 +1,10 @@
using Microsoft.PowerLauncher.Telemetry; // Copyright (c) Microsoft Corporation
using Microsoft.PowerToys.Telemetry; // The Microsoft Corporation licenses this file to you under the MIT license.
using System.Drawing; // See the LICENSE file in the project root for more information.
using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using Wox.Plugin; using Wox.Plugin;
namespace PowerLauncher.ViewModel namespace PowerLauncher.ViewModel
@@ -12,9 +14,13 @@ namespace PowerLauncher.ViewModel
private ICommand _command; private ICommand _command;
public string PluginName { get; set; } public string PluginName { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Glyph { get; set; } public string Glyph { get; set; }
public string FontFamily { get; set; } public string FontFamily { get; set; }
public ICommand Command public ICommand Command
{ {
get get
@@ -34,7 +40,9 @@ namespace PowerLauncher.ViewModel
} }
public Key AcceleratorKey { get; set; } public Key AcceleratorKey { get; set; }
public ModifierKeys AcceleratorModifiers { get; set; } public ModifierKeys AcceleratorModifiers { get; set; }
public bool IsAcceleratorKeyEnabled { get; set; } public bool IsAcceleratorKeyEnabled { get; set; }
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType) public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)

View File

@@ -1,25 +1,29 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using interop;
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using PowerLauncher.Helper;
using PowerLauncher.Storage;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Core.Resource; using Wox.Core.Resource;
using PowerLauncher.Helper;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Infrastructure.Hotkey; using Wox.Infrastructure.Hotkey;
using Wox.Infrastructure.Storage; using Wox.Infrastructure.Storage;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using Wox.Plugin; using Wox.Plugin;
using Microsoft.PowerLauncher.Telemetry;
using PowerLauncher.Storage;
using Microsoft.PowerToys.Telemetry;
using interop;
using System.Globalization;
namespace PowerLauncher.ViewModel namespace PowerLauncher.ViewModel
{ {
@@ -41,9 +45,12 @@ namespace PowerLauncher.ViewModel
private readonly TopMostRecord _topMostRecord; private readonly TopMostRecord _topMostRecord;
private CancellationTokenSource _updateSource { get; set; } private CancellationTokenSource _updateSource { get; set; }
private CancellationToken _updateToken; private CancellationToken _updateToken;
private bool _saved; private bool _saved;
private HotkeyManager _hotkeyManager { get; set; } private HotkeyManager _hotkeyManager { get; set; }
private ushort _hotkeyHandle; private ushort _hotkeyHandle;
private readonly Internationalization _translator = InternationalizationManager.Instance; private readonly Internationalization _translator = InternationalizationManager.Instance;
private System.Diagnostics.Stopwatch hotkeyTimer = new System.Diagnostics.Stopwatch(); private System.Diagnostics.Stopwatch hotkeyTimer = new System.Diagnostics.Stopwatch();
@@ -191,7 +198,7 @@ namespace PowerLauncher.ViewModel
if (results.SelectedItem != null) if (results.SelectedItem != null)
{ {
//If there is a context button selected fire the action for that button before the main command. // If there is a context button selected fire the action for that button before the main command.
bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton(); bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton();
if (!didExecuteContextButton) if (!didExecuteContextButton)
@@ -253,7 +260,7 @@ namespace PowerLauncher.ViewModel
if (!string.IsNullOrEmpty(QueryText)) if (!string.IsNullOrEmpty(QueryText))
{ {
ChangeQueryText(string.Empty, true); ChangeQueryText(string.Empty, true);
//Push Event to UI SystemQuery has changed // Push Event to UI SystemQuery has changed
OnPropertyChanged(nameof(SystemQueryText)); OnPropertyChanged(nameof(SystemQueryText));
} }
}); });
@@ -264,10 +271,13 @@ namespace PowerLauncher.ViewModel
#region ViewModel Properties #region ViewModel Properties
public Brush MainWindowBackground { get; set; } public Brush MainWindowBackground { get; set; }
public Brush MainWindowBorderBrush { get; set; } public Brush MainWindowBorderBrush { get; set; }
public ResultsViewModel Results { get; private set; } public ResultsViewModel Results { get; private set; }
public ResultsViewModel ContextMenu { get; private set; } public ResultsViewModel ContextMenu { get; private set; }
public ResultsViewModel History { get; private set; } public ResultsViewModel History { get; private set; }
public string SystemQueryText { get; set; } = String.Empty; public string SystemQueryText { get; set; } = String.Empty;
@@ -291,12 +301,15 @@ namespace PowerLauncher.ViewModel
Query(); Query();
} }
} }
public bool LastQuerySelected { get; set; } public bool LastQuerySelected { get; set; }
private ResultsViewModel _selectedResults; private ResultsViewModel _selectedResults;
private ResultsViewModel SelectedResults private ResultsViewModel SelectedResults
{ {
get { return _selectedResults; } get { return _selectedResults; }
set set
{ {
_selectedResults = value; _selectedResults = value;
@@ -311,7 +324,6 @@ namespace PowerLauncher.ViewModel
Results.Visibility = Visibility.Hidden; Results.Visibility = Visibility.Hidden;
_queryTextBeforeLeaveResults = QueryText; _queryTextBeforeLeaveResults = QueryText;
// Because of Fody's optimization // Because of Fody's optimization
// setter won't be called when property value is not changed. // setter won't be called when property value is not changed.
// so we need manually call Query() // so we need manually call Query()
@@ -336,6 +348,7 @@ namespace PowerLauncher.ViewModel
public Visibility MainWindowVisibility public Visibility MainWindowVisibility
{ {
get { return _visibility; } get { return _visibility; }
set set
{ {
_visibility = value; _visibility = value;
@@ -352,24 +365,36 @@ namespace PowerLauncher.ViewModel
} }
public ICommand IgnoreCommand { get; set; } public ICommand IgnoreCommand { get; set; }
public ICommand EscCommand { get; set; } public ICommand EscCommand { get; set; }
public ICommand SelectNextItemCommand { get; set; } public ICommand SelectNextItemCommand { get; set; }
public ICommand SelectPrevItemCommand { get; set; } public ICommand SelectPrevItemCommand { get; set; }
public ICommand SelectNextContextMenuItemCommand { get; set; } public ICommand SelectNextContextMenuItemCommand { get; set; }
public ICommand SelectPreviousContextMenuItemCommand { get; set; } public ICommand SelectPreviousContextMenuItemCommand { get; set; }
public ICommand SelectNextTabItemCommand { get; set; } public ICommand SelectNextTabItemCommand { get; set; }
public ICommand SelectPrevTabItemCommand { get; set; } public ICommand SelectPrevTabItemCommand { get; set; }
public ICommand SelectNextPageCommand { get; set; } public ICommand SelectNextPageCommand { get; set; }
public ICommand SelectPrevPageCommand { get; set; }
public ICommand SelectFirstResultCommand { get; set; }
public ICommand StartHelpCommand { get; set; }
public ICommand LoadContextMenuCommand { get; set; }
public ICommand LoadHistoryCommand { get; set; }
public ICommand OpenResultCommand { get; set; }
public ICommand ClearQueryCommand { get; set; }
public ICommand SelectPrevPageCommand { get; set; }
public ICommand SelectFirstResultCommand { get; set; }
public ICommand StartHelpCommand { get; set; }
public ICommand LoadContextMenuCommand { get; set; }
public ICommand LoadHistoryCommand { get; set; }
public ICommand OpenResultCommand { get; set; }
public ICommand ClearQueryCommand { get; set; }
#endregion #endregion
@@ -548,7 +573,6 @@ namespace PowerLauncher.ViewModel
} }
} }
private bool SelectedIsFromQueryResults() private bool SelectedIsFromQueryResults()
{ {
var selected = SelectedResults == Results; var selected = SelectedResults == Results;
@@ -561,7 +585,6 @@ namespace PowerLauncher.ViewModel
return selected; return selected;
} }
private bool HistorySelected() private bool HistorySelected()
{ {
var selected = SelectedResults == History; var selected = SelectedResults == History;
@@ -604,7 +627,7 @@ namespace PowerLauncher.ViewModel
/// <returns></returns> /// <returns></returns>
private bool ShouldIgnoreHotkeys() private bool ShouldIgnoreHotkeys()
{ {
//double if to omit calling win32 function // double if to omit calling win32 function
if (_settings.IgnoreHotkeysOnFullscreen) if (_settings.IgnoreHotkeysOnFullscreen)
if (WindowsInteropHelper.IsWindowFullscreen()) if (WindowsInteropHelper.IsWindowFullscreen())
return true; return true;
@@ -635,7 +658,6 @@ namespace PowerLauncher.ViewModel
// If launcher window was hidden and the hotkey was pressed, start telemetry event // If launcher window was hidden and the hotkey was pressed, start telemetry event
if (MainWindowVisibility != Visibility.Visible) if (MainWindowVisibility != Visibility.Visible)
{ {
StartHotkeyTimer(); StartHotkeyTimer();
} }
if (_settings.LastQueryMode == LastQueryMode.Empty) if (_settings.LastQueryMode == LastQueryMode.Empty)

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Windows.Input; using System.Windows.Input;
namespace PowerLauncher.ViewModel namespace PowerLauncher.ViewModel

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
@@ -21,7 +25,9 @@ namespace PowerLauncher.ViewModel
public ObservableCollection<ContextMenuItemViewModel> ContextMenuItems { get; } = new ObservableCollection<ContextMenuItemViewModel>(); public ObservableCollection<ContextMenuItemViewModel> ContextMenuItems { get; } = new ObservableCollection<ContextMenuItemViewModel>();
public ICommand ActivateContextButtonsHoverCommand { get; set; } public ICommand ActivateContextButtonsHoverCommand { get; set; }
public ICommand ActivateContextButtonsSelectionCommand { get; set; } public ICommand ActivateContextButtonsSelectionCommand { get; set; }
public ICommand DeactivateContextButtonsHoverCommand { get; set; } public ICommand DeactivateContextButtonsHoverCommand { get; set; }
public ICommand DeactivateContextButtonsSelectionCommand { get; set; } public ICommand DeactivateContextButtonsSelectionCommand { get; set; }
@@ -61,6 +67,7 @@ namespace PowerLauncher.ViewModel
{ {
ActivateContextButtons(ActivationType.Selection); ActivateContextButtons(ActivationType.Selection);
} }
public void ActivateContextButtons(ActivationType activationType) public void ActivateContextButtons(ActivationType activationType)
{ {
// Result does not contain any context menu items - we don't need to show the context menu ListView at all. // Result does not contain any context menu items - we don't need to show the context menu ListView at all.
@@ -84,7 +91,6 @@ namespace PowerLauncher.ViewModel
} }
} }
private void DeactivateContextButtonsHoverAction(object sender) private void DeactivateContextButtonsHoverAction(object sender)
{ {
DeactivateContextButtons(ActivationType.Hover); DeactivateContextButtons(ActivationType.Hover);
@@ -118,7 +124,6 @@ namespace PowerLauncher.ViewModel
} }
} }
public void LoadContextMenu() public void LoadContextMenu()
{ {
var results = PluginManager.GetContextMenusForPlugin(Result); var results = PluginManager.GetContextMenusForPlugin(Result);
@@ -142,7 +147,7 @@ namespace PowerLauncher.ViewModel
if (hideWindow) if (hideWindow)
{ {
//TODO - Do we hide the window // TODO - Do we hide the window
// MainWindowVisibility = Visibility.Collapsed; // MainWindowVisibility = Visibility.Collapsed;
} }
}) })
@@ -191,7 +196,7 @@ namespace PowerLauncher.ViewModel
} }
} }
//Returns false if we've already reached the last item. // Returns false if we've already reached the last item.
public bool SelectNextContextButton() public bool SelectNextContextButton()
{ {
if (ContextMenuSelectedIndex == (ContextMenuItems.Count - 1)) if (ContextMenuSelectedIndex == (ContextMenuItems.Count - 1))
@@ -204,7 +209,7 @@ namespace PowerLauncher.ViewModel
return true; return true;
} }
//Returns false if we've already reached the first item. // Returns false if we've already reached the first item.
public bool SelectPrevContextButton() public bool SelectPrevContextButton()
{ {
if (ContextMenuSelectedIndex == NoSelectionIndex) if (ContextMenuSelectedIndex == NoSelectionIndex)

View File

@@ -1,4 +1,7 @@
using PowerLauncher.Helper; // 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; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
@@ -6,6 +9,7 @@ using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using PowerLauncher.Helper;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using Wox.Plugin; using Wox.Plugin;
@@ -26,6 +30,7 @@ namespace PowerLauncher.ViewModel
Results = new ResultCollection(); Results = new ResultCollection();
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock); BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
} }
public ResultsViewModel(Settings settings) : this() public ResultsViewModel(Settings settings) : this()
{ {
_settings = settings ?? throw new ArgumentNullException(nameof(settings)); _settings = settings ?? throw new ArgumentNullException(nameof(settings));
@@ -52,15 +57,18 @@ namespace PowerLauncher.ViewModel
return _settings.MaxResultsToShow * 75; return _settings.MaxResultsToShow * 75;
} }
} }
public int SelectedIndex { get; set; } public int SelectedIndex { get; set; }
private ResultViewModel _selectedItem; private ResultViewModel _selectedItem;
public ResultViewModel SelectedItem public ResultViewModel SelectedItem
{ {
get { return _selectedItem; } get { return _selectedItem; }
set set
{ {
//value can be null when selecting an item in a virtualized list // value can be null when selecting an item in a virtualized list
if (value != null) if (value != null)
{ {
if (_selectedItem != null) if (_selectedItem != null)
@@ -78,9 +86,8 @@ namespace PowerLauncher.ViewModel
} }
} }
public Thickness Margin { get; set; } public Thickness Margin { get; set; }
public Visibility Visibility { get; set; } = Visibility.Hidden; public Visibility Visibility { get; set; } = Visibility.Hidden;
#endregion #endregion
@@ -116,7 +123,6 @@ namespace PowerLauncher.ViewModel
} }
} }
#endregion #endregion
#region Public Methods #region Public Methods
@@ -163,7 +169,7 @@ namespace PowerLauncher.ViewModel
public void SelectNextTabItem() public void SelectNextTabItem()
{ {
//Do nothing if there is no selected item or we've selected the next context button // Do nothing if there is no selected item or we've selected the next context button
if (!SelectedItem?.SelectNextContextButton() ?? true) if (!SelectedItem?.SelectNextContextButton() ?? true)
{ {
SelectNextResult(); SelectNextResult();
@@ -172,10 +178,10 @@ namespace PowerLauncher.ViewModel
public void SelectPrevTabItem() public void SelectPrevTabItem()
{ {
//Do nothing if there is no selected item or we've selected the previous context button // Do nothing if there is no selected item or we've selected the previous context button
if (!SelectedItem?.SelectPrevContextButton() ?? true) if (!SelectedItem?.SelectPrevContextButton() ?? true)
{ {
//Tabbing backwards should highlight the last item of the previous row // Tabbing backwards should highlight the last item of the previous row
SelectPrevResult(); SelectPrevResult();
SelectedItem.SelectLastContextButton(); SelectedItem.SelectLastContextButton();
} }
@@ -268,6 +274,5 @@ namespace PowerLauncher.ViewModel
} }
#endregion #endregion
} }
} }

View File

@@ -1,3 +1,7 @@
// 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.Globalization; using System.Globalization;
using Wox.Core.Resource; using Wox.Core.Resource;
using Wox.Infrastructure.Storage; using Wox.Infrastructure.Storage;

View File

@@ -1,4 +1,8 @@
namespace Wox.Plugin // 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.
namespace Wox.Plugin
{ {
public class ActionContext public class ActionContext
{ {
@@ -8,8 +12,11 @@
public class SpecialKeyState public class SpecialKeyState
{ {
public bool CtrlPressed { get; set; } public bool CtrlPressed { get; set; }
public bool ShiftPressed { get; set; } public bool ShiftPressed { get; set; }
public bool AltPressed { get; set; } public bool AltPressed { get; set; }
public bool WinPressed { get; set; } public bool WinPressed { get; set; }
} }
} }

View File

@@ -1,4 +1,8 @@
namespace Wox.Plugin // 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.
namespace Wox.Plugin
{ {
public static class AllowedLanguage public static class AllowedLanguage
{ {

View File

@@ -1,7 +1,9 @@
using System; // 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.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows;
using JetBrains.Annotations; using JetBrains.Annotations;
namespace Wox.Plugin namespace Wox.Plugin

View File

@@ -1,9 +1,12 @@
using System; // 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;
using System.Windows.Input; using System.Windows.Input;
namespace Wox.Plugin namespace Wox.Plugin
{ {
public class ContextMenuResult public class ContextMenuResult
{ {
public string PluginName { get; set; } public string PluginName { get; set; }

View File

@@ -1,9 +1,14 @@
using System.Windows; // 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.Windows;
using System.Windows.Input; using System.Windows.Input;
namespace Wox.Plugin namespace Wox.Plugin
{ {
public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e); public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e);
public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e); public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e);
public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e); public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e);
@@ -11,6 +16,7 @@ namespace Wox.Plugin
public class WoxKeyDownEventArgs public class WoxKeyDownEventArgs
{ {
public string Query { get; set; } public string Query { get; set; }
public KeyEventArgs keyEventArgs { get; set; } public KeyEventArgs keyEventArgs { get; set; }
} }

View File

@@ -1,6 +1,9 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
namespace Wox.Plugin namespace Wox.Plugin
{ {

View File

@@ -1,4 +1,8 @@
using System; // 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;
namespace Wox.Plugin.Features namespace Wox.Plugin.Features
{ {

View File

@@ -1,4 +1,8 @@
using System; // 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;
namespace Wox.Plugin.Features namespace Wox.Plugin.Features
{ {

View File

@@ -1,4 +1,8 @@
using System; // 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;
namespace Wox.Plugin.Features namespace Wox.Plugin.Features
{ {

View File

@@ -1,10 +1,15 @@
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;
namespace Wox.Plugin namespace Wox.Plugin
{ {
public interface IPlugin public interface IPlugin
{ {
List<Result> Query(Query query); List<Result> Query(Query query);
void Init(PluginInitContext context); void Init(PluginInitContext context);
} }
} }

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;
namespace Wox.Plugin namespace Wox.Plugin
{ {

View File

@@ -1,11 +1,16 @@
using Microsoft.PowerToys.Settings.UI.Lib; // 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.Windows.Controls; using System.Windows.Controls;
using Microsoft.PowerToys.Settings.UI.Lib;
namespace Wox.Plugin namespace Wox.Plugin
{ {
public interface ISettingProvider public interface ISettingProvider
{ {
Control CreateSettingPanel(); Control CreateSettingPanel();
void UpdateSettings(PowerLauncherSettings settings); void UpdateSettings(PowerLauncherSettings settings);
} }
} }

View File

@@ -1,4 +1,8 @@
namespace Wox.Plugin // 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.
namespace Wox.Plugin
{ {
/// <summary> /// <summary>
/// This interface is to indicate and allow plugins to reload their /// This interface is to indicate and allow plugins to reload their

View File

@@ -1,4 +1,6 @@
using System; // 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.
namespace Wox.Plugin namespace Wox.Plugin
{ {

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -9,14 +13,23 @@ namespace Wox.Plugin
public class PluginMetadata : BaseModel public class PluginMetadata : BaseModel
{ {
private string _pluginDirectory; private string _pluginDirectory;
public string ID { get; set; } public string ID { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Author { get; set; } public string Author { get; set; }
public string Version { get; set; } public string Version { get; set; }
public string Language { get; set; } public string Language { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Website { get; set; } public string Website { get; set; }
public bool Disabled { get; set; } public bool Disabled { get; set; }
public string ExecuteFilePath { get; private set; } public string ExecuteFilePath { get; private set; }
public string ExecuteFileName { get; set; } public string ExecuteFileName { get; set; }
@@ -24,6 +37,7 @@ namespace Wox.Plugin
public string PluginDirectory public string PluginDirectory
{ {
get { return _pluginDirectory; } get { return _pluginDirectory; }
internal set internal set
{ {
_pluginDirectory = value; _pluginDirectory = value;
@@ -51,8 +65,10 @@ namespace Wox.Plugin
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
public long InitTime { get; set; } public long InitTime { get; set; }
[JsonIgnore] [JsonIgnore]
public long AvgQueryTime { get; set; } public long AvgQueryTime { get; set; }
[JsonIgnore] [JsonIgnore]
public int QueryCount { get; set; } public int QueryCount { get; set; }
} }

View File

@@ -1,8 +1,13 @@
namespace Wox.Plugin // 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.
namespace Wox.Plugin
{ {
public class PluginPair public class PluginPair
{ {
public IPlugin Plugin { get; internal set; } public IPlugin Plugin { get; internal set; }
public PluginMetadata Metadata { get; internal set; } public PluginMetadata Metadata { get; internal set; }

View File

@@ -1,4 +1,8 @@
using System.Runtime.CompilerServices; // 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.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("PowerLauncher")] [assembly: InternalsVisibleTo("PowerLauncher")]
[assembly: InternalsVisibleTo("Wox")] [assembly: InternalsVisibleTo("Wox")]

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,27 +1,32 @@
using System; // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Windows.Media;
using System.Windows; using System.Windows;
using System.Windows.Media;
namespace Wox.Plugin namespace Wox.Plugin
{ {
public class Result public class Result
{ {
private string _title; private string _title;
private ToolTipData _toolTipData; private ToolTipData _toolTipData;
private string _pluginDirectory; private string _pluginDirectory;
private string _icoPath; private string _icoPath;
public string Title public string Title
{ {
get { return _title; } get { return _title; }
set set
{ {
_title = value.Replace("\n", " "); _title = value.Replace("\n", " ");
} }
} }
public string SubTitle { get; set; } public string SubTitle { get; set; }
public string Glyph { get; set; } public string Glyph { get; set; }
@@ -36,6 +41,7 @@ namespace Wox.Plugin
{ {
return _toolTipData; return _toolTipData;
} }
set set
{ {
_toolTipData = value; _toolTipData = value;
@@ -51,6 +57,7 @@ namespace Wox.Plugin
public string IcoPath public string IcoPath
{ {
get { return _icoPath; } get { return _icoPath; }
set set
{ {
if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value)) if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value))
@@ -97,6 +104,7 @@ namespace Wox.Plugin
public string PluginDirectory public string PluginDirectory
{ {
get { return _pluginDirectory; } get { return _pluginDirectory; }
set set
{ {
_pluginDirectory = value; _pluginDirectory = value;

View File

@@ -1,4 +1,8 @@
using System; // 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;
using System.IO; using System.IO;
using System.Windows; using System.Windows;

View File

@@ -1,3 +1,7 @@
// 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; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
@@ -53,6 +57,7 @@ namespace Wox.Plugin.SharedCommands
Process.Start(url); Process.Start(url);
} }
} }
// This error may be thrown for Process.Start(browserPath, url) // This error may be thrown for Process.Start(browserPath, url)
catch (System.ComponentModel.Win32Exception) catch (System.ComponentModel.Win32Exception)
{ {

View File

@@ -1,19 +1,23 @@
using System; // Copyright (c) Microsoft Corporation
using System.Collections.Generic; // 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;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace Wox.Plugin.SharedCommands namespace Wox.Plugin.SharedCommands
{ {
public static class ShellCommand public static class ShellCommand
{ {
public delegate bool EnumThreadDelegate(IntPtr hwnd, IntPtr lParam); public delegate bool EnumThreadDelegate(IntPtr hwnd, IntPtr lParam);
[DllImport("user32.dll")] static extern bool EnumThreadWindows(uint threadId, EnumThreadDelegate lpfn, IntPtr lParam); [DllImport("user32.dll")] static extern bool EnumThreadWindows(uint threadId, EnumThreadDelegate lpfn, IntPtr lParam);
[DllImport("user32.dll")] static extern int GetWindowText(IntPtr hwnd, StringBuilder lpString, int nMaxCount); [DllImport("user32.dll")] static extern int GetWindowText(IntPtr hwnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")] static extern int GetWindowTextLength(IntPtr hwnd); [DllImport("user32.dll")] static extern int GetWindowTextLength(IntPtr hwnd);
private static bool containsSecurityWindow; private static bool containsSecurityWindow;
@@ -29,6 +33,7 @@ namespace Wox.Plugin.SharedCommands
CheckSecurityWindow(); CheckSecurityWindow();
Thread.Sleep(25); Thread.Sleep(25);
} }
while (containsSecurityWindow) // while this process contains a "Windows Security" dialog, stay open while (containsSecurityWindow) // while this process contains a "Windows Security" dialog, stay open
{ {
containsSecurityWindow = false; containsSecurityWindow = false;

View File

@@ -1,10 +1,13 @@
using ControlzEx.Theming; // Copyright (c) Microsoft Corporation
using MahApps.Metro.Theming; // The Microsoft Corporation licenses this file to you under the MIT license.
using Microsoft.Win32; // See the LICENSE file in the project root for more information.
using System; using System;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using ControlzEx.Theming;
using MahApps.Metro.Theming;
using Microsoft.Win32;
namespace Wox.Plugin namespace Wox.Plugin
{ {
@@ -142,6 +145,7 @@ namespace Wox.Plugin
{ {
currentTheme = Theme.None; currentTheme = Theme.None;
} }
ThemeChanged?.Invoke(oldTheme, currentTheme); ThemeChanged?.Invoke(oldTheme, currentTheme);
} }

View File

@@ -1,4 +1,8 @@
using System; // 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;
namespace Wox.Plugin namespace Wox.Plugin
{ {
@@ -14,6 +18,7 @@ namespace Wox.Plugin
{ {
throw new ArgumentException("title cannot be null or empty", "title"); throw new ArgumentException("title cannot be null or empty", "title");
} }
Title = title; Title = title;
Text = text; Text = text;
} }

View File

@@ -68,5 +68,19 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" /> <ProjectReference Include="..\..\..\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" />
</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>-->
</Project> </Project>

View File

@@ -1,3 +1,7 @@
// 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; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View File

@@ -1,4 +1,8 @@
using Moq; // 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 Moq;
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Infrastructure.Exception; using Wox.Infrastructure.Exception;
@@ -11,7 +15,7 @@ namespace Wox.Test.Plugins
[Test] [Test]
public void PublicAPIIsNullTest() public void PublicAPIIsNullTest()
{ {
//Assert.Throws(typeof(WoxFatalException), () => PluginManager.Initialize(null)); // Assert.Throws(typeof(WoxFatalException), () => PluginManager.Initialize(null));
} }
} }
} }

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Search.Interop; using Microsoft.Search.Interop;

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 NUnit.Framework; using NUnit.Framework;
using Wox.Core.Plugin; using Wox.Core.Plugin;
using Wox.Plugin; using Wox.Plugin;

View File

@@ -1,4 +1,8 @@
using NUnit.Framework; // 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 NUnit.Framework;
using PowerLauncher.ViewModel; using PowerLauncher.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -41,7 +45,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
@@ -62,7 +65,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
@@ -91,7 +93,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
@@ -115,7 +116,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
rvm.SelectPreviousContextMenuItem(); rvm.SelectPreviousContextMenuItem();
@@ -137,7 +137,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
bool isContextMenuItemSelected = rvm.IsContextMenuItemSelected(); bool isContextMenuItemSelected = rvm.IsContextMenuItemSelected();
@@ -159,7 +158,6 @@ namespace Wox.Test
}); });
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Act // Act
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
rvm.SelectPreviousContextMenuItem(); rvm.SelectPreviousContextMenuItem();

View File

@@ -1,5 +1,9 @@
using NUnit.Framework; // Copyright (c) Microsoft Corporation
//using Wox.Plugin.Url; // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using NUnit.Framework;
// using Wox.Plugin.Url;
namespace Wox.Test namespace Wox.Test
{ {
@@ -9,24 +13,23 @@ namespace Wox.Test
[Test] [Test]
public void URLMatchTest() public void URLMatchTest()
{ {
//var plugin = new Main(); // var plugin = new Main();
//Assert.IsTrue(plugin.IsURL("http://www.google.com")); // Assert.IsTrue(plugin.IsURL("http://www.google.com"));
//Assert.IsTrue(plugin.IsURL("https://www.google.com")); // Assert.IsTrue(plugin.IsURL("https://www.google.com"));
//Assert.IsTrue(plugin.IsURL("http://google.com")); // Assert.IsTrue(plugin.IsURL("http://google.com"));
//Assert.IsTrue(plugin.IsURL("www.google.com")); // Assert.IsTrue(plugin.IsURL("www.google.com"));
//Assert.IsTrue(plugin.IsURL("google.com")); // Assert.IsTrue(plugin.IsURL("google.com"));
//Assert.IsTrue(plugin.IsURL("http://localhost")); // Assert.IsTrue(plugin.IsURL("http://localhost"));
//Assert.IsTrue(plugin.IsURL("https://localhost")); // Assert.IsTrue(plugin.IsURL("https://localhost"));
//Assert.IsTrue(plugin.IsURL("http://localhost:80")); // Assert.IsTrue(plugin.IsURL("http://localhost:80"));
//Assert.IsTrue(plugin.IsURL("https://localhost:80")); // Assert.IsTrue(plugin.IsURL("https://localhost:80"));
//Assert.IsTrue(plugin.IsURL("http://110.10.10.10")); // Assert.IsTrue(plugin.IsURL("http://110.10.10.10"));
//Assert.IsTrue(plugin.IsURL("110.10.10.10")); // Assert.IsTrue(plugin.IsURL("110.10.10.10"));
//Assert.IsTrue(plugin.IsURL("ftp://110.10.10.10")); // Assert.IsTrue(plugin.IsURL("ftp://110.10.10.10"));
// Assert.IsFalse(plugin.IsURL("wwww"));
//Assert.IsFalse(plugin.IsURL("wwww")); // Assert.IsFalse(plugin.IsURL("wwww.c"));
//Assert.IsFalse(plugin.IsURL("wwww.c")); // Assert.IsFalse(plugin.IsURL("wwww.c"));
//Assert.IsFalse(plugin.IsURL("wwww.c"));
} }
} }
} }

View File

@@ -57,5 +57,19 @@
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.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>-->
</Project> </Project>

View File

@@ -1,4 +1,8 @@
using System.Windows.Input; // 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.Windows.Input;
using NUnit.Framework; using NUnit.Framework;
using Wox.Plugin; using Wox.Plugin;
using PowerLauncher.ViewModel; using PowerLauncher.ViewModel;
@@ -39,7 +43,6 @@ namespace Wox.Test
} }
} }
[Test] [Test]
public void AnyVariable_MustCallOnPropertyChanged_WhenSet() public void AnyVariable_MustCallOnPropertyChanged_WhenSet()
{ {