mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
fixing most whitespace issues, reordering namespaces and adding in headers (#5677)
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
// 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.Events;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
|
||||
@@ -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.Events;
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
@@ -15,10 +15,11 @@ namespace Microsoft.PowerLauncher.Telemetry
|
||||
public class LauncherQueryEvent : EventBase, IEvent
|
||||
{
|
||||
public double QueryTimeMs { get; set; }
|
||||
|
||||
public int QueryLength { get; set; }
|
||||
|
||||
public int NumResults { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
@@ -14,15 +14,16 @@ namespace Microsoft.PowerLauncher.Telemetry
|
||||
[EventData]
|
||||
public class LauncherResultActionEvent : EventBase, IEvent
|
||||
{
|
||||
|
||||
public enum TriggerType
|
||||
{
|
||||
Click,
|
||||
KeyboardShortcut
|
||||
KeyboardShortcut,
|
||||
}
|
||||
|
||||
public string Trigger { get; set; }
|
||||
|
||||
public string PluginName { get; set; }
|
||||
|
||||
public string ActionName { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
|
||||
@@ -18,5 +18,19 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" />
|
||||
</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>
|
||||
|
||||
@@ -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.Resource;
|
||||
using Wox.Infrastructure.Exception;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
|
||||
@@ -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 Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using PowerLauncher.Helper;
|
||||
using PowerLauncher.ViewModel;
|
||||
using Wox;
|
||||
using Wox.Core;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using PowerLauncher.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using PowerLauncher.ViewModel;
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
|
||||
namespace PowerLauncher
|
||||
@@ -26,6 +26,7 @@ namespace PowerLauncher
|
||||
public partial class App : IDisposable, ISingleInstanceApp
|
||||
{
|
||||
public static PublicAPIInstance API { get; private set; }
|
||||
|
||||
private const string Unique = "PowerLauncher_Unique_Application_Mutex";
|
||||
private static bool _disposed = false;
|
||||
private static int _powerToysPid;
|
||||
@@ -66,7 +67,6 @@ namespace PowerLauncher
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
});
|
||||
@@ -122,7 +122,7 @@ namespace PowerLauncher
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
|
||||
|
||||
//[Conditional("RELEASE")]
|
||||
// [Conditional("RELEASE")]
|
||||
// check update every 5 hours
|
||||
|
||||
// check updates on startup
|
||||
@@ -156,7 +156,6 @@ namespace PowerLauncher
|
||||
DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// let exception throw as normal is better for Debug
|
||||
/// </summary>
|
||||
@@ -212,4 +211,4 @@ namespace PowerLauncher
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Net;
|
||||
|
||||
@@ -40,6 +44,7 @@ namespace PowerLauncher.Helper
|
||||
public override string ContentType
|
||||
{
|
||||
get { return m_contentType; }
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -49,6 +54,7 @@ namespace PowerLauncher.Helper
|
||||
public override long ContentLength
|
||||
{
|
||||
get { return m_data.Length; }
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
|
||||
@@ -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 NLog;
|
||||
using Wox.Infrastructure;
|
||||
@@ -22,15 +26,15 @@ namespace PowerLauncher.Helper
|
||||
|
||||
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle non-ui thread exceptions
|
||||
// handle non-ui thread exceptions
|
||||
Report((Exception)e?.ExceptionObject);
|
||||
}
|
||||
|
||||
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle ui thread exceptions
|
||||
// handle ui thread exceptions
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
// 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 Wox.Plugin;
|
||||
|
||||
|
||||
@@ -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.Specialized;
|
||||
using PowerLauncher.ViewModel;
|
||||
|
||||
namespace PowerLauncher.Helper
|
||||
{
|
||||
@@ -42,4 +46,4 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
// 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.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO.Pipes;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using static PowerLauncher.Helper.WindowsInteropHelper;
|
||||
|
||||
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/
|
||||
@@ -99,7 +100,6 @@ namespace PowerLauncher.Helper
|
||||
XBUTTONDBLCLK = 0x020D,
|
||||
MOUSEHWHEEL = 0x020E,
|
||||
|
||||
|
||||
CAPTURECHANGED = 0x0215,
|
||||
|
||||
ENTERSIZEMOVE = 0x0231,
|
||||
@@ -131,7 +131,7 @@ namespace PowerLauncher.Helper
|
||||
|
||||
// This is the hard-coded message value used by WinForms for Shell_NotifyIcon.
|
||||
// It's relatively safe to reuse.
|
||||
TRAYMOUSEMESSAGE = 0x800, //WM_USER + 1024
|
||||
TRAYMOUSEMESSAGE = 0x800, // WM_USER + 1024
|
||||
APP = 0x8000
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ namespace PowerLauncher.Helper
|
||||
[DllImport("shell32.dll", EntryPoint = "CommandLineToArgvW", CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs);
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)]
|
||||
internal static extern IntPtr _LocalFree(IntPtr hMem);
|
||||
|
||||
@@ -201,7 +200,6 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
IntPtr p = _LocalFree(argv);
|
||||
// Otherwise LocalFree failed.
|
||||
// Assert.AreEqual(IntPtr.Zero, p);
|
||||
@@ -216,7 +214,7 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class checks to make sure that only one instance of
|
||||
/// This class checks to make sure that only one instance of
|
||||
/// this application is running at a time.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -256,7 +254,7 @@ namespace PowerLauncher.Helper
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the instance of the application attempting to start is the first instance.
|
||||
/// Checks if the instance of the application attempting to start is the first instance.
|
||||
/// If not, activates the first instance.
|
||||
/// </summary>
|
||||
/// <returns>True if this is the first instance of the application.</returns>
|
||||
@@ -267,7 +265,7 @@ namespace PowerLauncher.Helper
|
||||
|
||||
string channelName = String.Concat(applicationIdentifier, Delimiter, ChannelNameSuffix);
|
||||
|
||||
// Create mutex based on unique application Id to check if this is the first instance of the application.
|
||||
// Create mutex based on unique application Id to check if this is the first instance of the application.
|
||||
bool firstInstance;
|
||||
singleInstanceMutex = new Mutex(true, applicationIdentifier, out firstInstance);
|
||||
if (firstInstance)
|
||||
@@ -309,12 +307,11 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
|
||||
// The application was clickonce deployed
|
||||
// Clickonce deployed apps cannot receive traditional commandline arguments
|
||||
// As a workaround commandline arguments can be written to a shared location before
|
||||
// the app is launched and the app can obtain its commandline arguments from the
|
||||
// shared location
|
||||
// As a workaround commandline arguments can be written to a shared location before
|
||||
// the app is launched and the app can obtain its commandline arguments from the
|
||||
// shared location
|
||||
string appFolderPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), uniqueApplicationName);
|
||||
|
||||
@@ -345,7 +342,7 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a remote server pipe for communication.
|
||||
/// Creates a remote server pipe for communication.
|
||||
/// Once receives signal from client, will activate first instance.
|
||||
/// </summary>
|
||||
/// <param name="channelName">Application's IPC channel name.</param>
|
||||
|
||||
@@ -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.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -12,13 +16,13 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
public static class WindowsInteropHelper
|
||||
{
|
||||
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 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 static IntPtr _hwnd_shell;
|
||||
private static IntPtr _hwnd_desktop;
|
||||
|
||||
//Accessors for shell and desktop handlers
|
||||
//Will set the variables once and then will return them
|
||||
// Accessors for shell and desktop handlers
|
||||
// Will set the variables once and then will return them
|
||||
private static IntPtr HWND_SHELL
|
||||
{
|
||||
get
|
||||
@@ -101,19 +105,19 @@ namespace PowerLauncher.Helper
|
||||
|
||||
public static bool IsWindowFullscreen()
|
||||
{
|
||||
//get current active window
|
||||
// get current active window
|
||||
IntPtr hWnd = NativeMethods.GetForegroundWindow();
|
||||
|
||||
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)))
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(256);
|
||||
_ = NativeMethods.GetClassName(hWnd, sb, sb.Capacity);
|
||||
string windowClass = sb.ToString();
|
||||
|
||||
//for Win+Tab (Flip3D)
|
||||
// for Win+Tab (Flip3D)
|
||||
if (windowClass == WINDOW_CLASS_WINTAB)
|
||||
{
|
||||
return false;
|
||||
@@ -122,13 +126,13 @@ namespace PowerLauncher.Helper
|
||||
RECT 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct RECT
|
||||
{
|
||||
@@ -195,4 +198,4 @@ namespace PowerLauncher.Helper
|
||||
public int Bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -12,4 +16,4 @@ namespace PowerLauncher
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerLauncher.Helper;
|
||||
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;
|
||||
using System.ComponentModel;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerLauncher.Helper;
|
||||
using PowerLauncher.ViewModel;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using Screen = System.Windows.Forms.Screen;
|
||||
|
||||
|
||||
namespace PowerLauncher
|
||||
{
|
||||
public partial class MainWindow : IDisposable
|
||||
{
|
||||
|
||||
#region Private Fields
|
||||
private Settings _settings;
|
||||
private MainViewModel _viewModel;
|
||||
@@ -53,6 +55,7 @@ namespace PowerLauncher
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -106,7 +109,7 @@ namespace PowerLauncher
|
||||
{
|
||||
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)
|
||||
{
|
||||
_viewModel.Results.SelectedItem = resultVM;
|
||||
@@ -122,7 +125,7 @@ namespace PowerLauncher
|
||||
if (Visibility == System.Windows.Visibility.Visible)
|
||||
{
|
||||
// Not called on first launch
|
||||
// Additionally called when deactivated by clicking on screen
|
||||
// Additionally called when deactivated by clicking on screen
|
||||
UpdatePosition();
|
||||
BringProcessToForeground();
|
||||
|
||||
@@ -170,7 +173,7 @@ namespace PowerLauncher
|
||||
{
|
||||
if (_settings.HideWhenDeactivated)
|
||||
{
|
||||
//(this.FindResource("OutroStoryboard") as Storyboard).Begin();
|
||||
// (this.FindResource("OutroStoryboard") as Storyboard).Begin();
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
@@ -304,7 +307,7 @@ namespace PowerLauncher
|
||||
}
|
||||
|
||||
// To populate the AutoCompleteTextBox as soon as the selection is changed or set.
|
||||
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
|
||||
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
|
||||
if (_viewModel.Results != null)
|
||||
{
|
||||
SearchBox.AutoCompleteTextBlock.Text = MainViewModel.GetAutoCompleteText(
|
||||
@@ -396,7 +399,7 @@ namespace PowerLauncher
|
||||
SearchBox.AutoCompleteTextBlock.FlowDirection = MainViewModel.GetLanguageFlowDirection();
|
||||
}
|
||||
|
||||
private void SearchBox_InputLanguageChanged(object sender, InputLanguageEventArgs e)
|
||||
private void SearchBox_InputLanguageChanged(object sender, InputLanguageEventArgs e)
|
||||
{
|
||||
SearchBox_UpdateFlowDirection();
|
||||
}
|
||||
|
||||
@@ -259,5 +259,19 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</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>
|
||||
@@ -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.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
@@ -60,7 +63,7 @@ namespace Wox
|
||||
|
||||
public void CheckForNewUpdate()
|
||||
{
|
||||
//_settingsVM.UpdateApp();
|
||||
// _settingsVM.UpdateApp();
|
||||
}
|
||||
|
||||
public void SaveAppAllSettings()
|
||||
|
||||
@@ -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.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using PowerLauncher.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using System.Windows.Navigation;
|
||||
using Wox.Infrastructure.Image;
|
||||
using System.Drawing;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Wox.Infrastructure.Logger;
|
||||
|
||||
namespace PowerLauncher
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -12,4 +16,4 @@ namespace PowerLauncher
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
// The SettingChanging event is raised before 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.
|
||||
internal sealed partial class Settings
|
||||
{
|
||||
|
||||
public Settings()
|
||||
{
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using 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.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using System.Windows.Input;
|
||||
using Wox.Core.Plugin;
|
||||
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
|
||||
{
|
||||
@@ -22,6 +22,7 @@ namespace PowerLauncher
|
||||
private static object _watcherSyncObject = new object();
|
||||
private FileSystemWatcher _watcher;
|
||||
private Settings _settings;
|
||||
|
||||
public SettingsWatcher(Settings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
@@ -89,7 +90,7 @@ namespace PowerLauncher
|
||||
|
||||
retry = false;
|
||||
}
|
||||
// the settings application can hold a lock on the settings.json file which will result in a IOException.
|
||||
// the settings application can hold a lock on the settings.json file which will result in a IOException.
|
||||
// This should be changed to properly synch with the settings app instead of retrying.
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
namespace PowerLauncher.Storage
|
||||
@@ -5,6 +9,7 @@ namespace PowerLauncher.Storage
|
||||
public class HistoryItem
|
||||
{
|
||||
public string Query { get; set; }
|
||||
|
||||
public DateTime ExecutedDateTime { get; set; }
|
||||
|
||||
public string GetTimeAgo()
|
||||
@@ -42,4 +47,4 @@ namespace PowerLauncher.Storage
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.Storage
|
||||
{
|
||||
|
||||
@@ -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 Newtonsoft.Json;
|
||||
using Wox.Plugin;
|
||||
@@ -18,7 +22,7 @@ namespace PowerLauncher.Storage
|
||||
return false;
|
||||
}
|
||||
|
||||
// since this dictionary should be very small (or empty) going over it should be pretty fast.
|
||||
// since this dictionary should be very small (or empty) going over it should be pretty fast.
|
||||
return records.Any(o => o.Value.Title == result.Title
|
||||
&& o.Value.SubTitle == result.SubTitle
|
||||
&& o.Value.PluginID == result.PluginID
|
||||
@@ -48,11 +52,12 @@ namespace PowerLauncher.Storage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Record
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string SubTitle { get; set; }
|
||||
|
||||
public string PluginID { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 Newtonsoft.Json;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.Storage
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
// 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 Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
@@ -12,9 +14,13 @@ namespace PowerLauncher.ViewModel
|
||||
private ICommand _command;
|
||||
|
||||
public string PluginName { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Glyph { get; set; }
|
||||
|
||||
public string FontFamily { get; set; }
|
||||
|
||||
public ICommand Command
|
||||
{
|
||||
get
|
||||
@@ -34,7 +40,9 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
|
||||
public Key AcceleratorKey { get; set; }
|
||||
|
||||
public ModifierKeys AcceleratorModifiers { get; set; }
|
||||
|
||||
public bool IsAcceleratorKeyEnabled { get; set; }
|
||||
|
||||
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)
|
||||
@@ -49,4 +57,4 @@ namespace PowerLauncher.ViewModel
|
||||
PowerToysTelemetry.Log.WriteEvent(eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
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.Resource;
|
||||
using PowerLauncher.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using PowerLauncher.Storage;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using interop;
|
||||
using System.Globalization;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
{
|
||||
@@ -41,9 +45,12 @@ namespace PowerLauncher.ViewModel
|
||||
private readonly TopMostRecord _topMostRecord;
|
||||
|
||||
private CancellationTokenSource _updateSource { get; set; }
|
||||
|
||||
private CancellationToken _updateToken;
|
||||
private bool _saved;
|
||||
|
||||
private HotkeyManager _hotkeyManager { get; set; }
|
||||
|
||||
private ushort _hotkeyHandle;
|
||||
private readonly Internationalization _translator = InternationalizationManager.Instance;
|
||||
private System.Diagnostics.Stopwatch hotkeyTimer = new System.Diagnostics.Stopwatch();
|
||||
@@ -191,7 +198,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
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();
|
||||
|
||||
if (!didExecuteContextButton)
|
||||
@@ -253,7 +260,7 @@ namespace PowerLauncher.ViewModel
|
||||
if (!string.IsNullOrEmpty(QueryText))
|
||||
{
|
||||
ChangeQueryText(string.Empty, true);
|
||||
//Push Event to UI SystemQuery has changed
|
||||
// Push Event to UI SystemQuery has changed
|
||||
OnPropertyChanged(nameof(SystemQueryText));
|
||||
}
|
||||
});
|
||||
@@ -264,10 +271,13 @@ namespace PowerLauncher.ViewModel
|
||||
#region ViewModel Properties
|
||||
|
||||
public Brush MainWindowBackground { get; set; }
|
||||
|
||||
public Brush MainWindowBorderBrush { get; set; }
|
||||
|
||||
public ResultsViewModel Results { get; private set; }
|
||||
|
||||
public ResultsViewModel ContextMenu { get; private set; }
|
||||
|
||||
public ResultsViewModel History { get; private set; }
|
||||
|
||||
public string SystemQueryText { get; set; } = String.Empty;
|
||||
@@ -276,7 +286,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
/// <summary>
|
||||
/// we need move cursor to end when we manually changed query
|
||||
/// but we don't want to move cursor to end when query is updated from TextBox.
|
||||
/// but we don't want to move cursor to end when query is updated from TextBox.
|
||||
/// Also we don't want to force the results to change unless explicitly told to.
|
||||
/// </summary>
|
||||
/// <param name="queryText"></param>
|
||||
@@ -291,12 +301,15 @@ namespace PowerLauncher.ViewModel
|
||||
Query();
|
||||
}
|
||||
}
|
||||
|
||||
public bool LastQuerySelected { get; set; }
|
||||
|
||||
private ResultsViewModel _selectedResults;
|
||||
|
||||
private ResultsViewModel SelectedResults
|
||||
{
|
||||
get { return _selectedResults; }
|
||||
|
||||
set
|
||||
{
|
||||
_selectedResults = value;
|
||||
@@ -311,7 +324,6 @@ namespace PowerLauncher.ViewModel
|
||||
Results.Visibility = Visibility.Hidden;
|
||||
_queryTextBeforeLeaveResults = QueryText;
|
||||
|
||||
|
||||
// Because of Fody's optimization
|
||||
// setter won't be called when property value is not changed.
|
||||
// so we need manually call Query()
|
||||
@@ -336,6 +348,7 @@ namespace PowerLauncher.ViewModel
|
||||
public Visibility MainWindowVisibility
|
||||
{
|
||||
get { return _visibility; }
|
||||
|
||||
set
|
||||
{
|
||||
_visibility = value;
|
||||
@@ -352,24 +365,36 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
|
||||
public ICommand IgnoreCommand { get; set; }
|
||||
|
||||
public ICommand EscCommand { get; set; }
|
||||
|
||||
public ICommand SelectNextItemCommand { get; set; }
|
||||
|
||||
public ICommand SelectPrevItemCommand { get; set; }
|
||||
|
||||
public ICommand SelectNextContextMenuItemCommand { get; set; }
|
||||
|
||||
public ICommand SelectPreviousContextMenuItemCommand { get; set; }
|
||||
|
||||
public ICommand SelectNextTabItemCommand { get; set; }
|
||||
|
||||
public ICommand SelectPrevTabItemCommand { 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
|
||||
|
||||
@@ -548,7 +573,6 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool SelectedIsFromQueryResults()
|
||||
{
|
||||
var selected = SelectedResults == Results;
|
||||
@@ -561,7 +585,6 @@ namespace PowerLauncher.ViewModel
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
||||
private bool HistorySelected()
|
||||
{
|
||||
var selected = SelectedResults == History;
|
||||
@@ -604,7 +627,7 @@ namespace PowerLauncher.ViewModel
|
||||
/// <returns></returns>
|
||||
private bool ShouldIgnoreHotkeys()
|
||||
{
|
||||
//double if to omit calling win32 function
|
||||
// double if to omit calling win32 function
|
||||
if (_settings.IgnoreHotkeysOnFullscreen)
|
||||
if (WindowsInteropHelper.IsWindowFullscreen())
|
||||
return true;
|
||||
@@ -635,7 +658,6 @@ namespace PowerLauncher.ViewModel
|
||||
// If launcher window was hidden and the hotkey was pressed, start telemetry event
|
||||
if (MainWindowVisibility != Visibility.Visible)
|
||||
{
|
||||
|
||||
StartHotkeyTimer();
|
||||
}
|
||||
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||
@@ -857,4 +879,4 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
|
||||
@@ -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.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
@@ -21,7 +25,9 @@ namespace PowerLauncher.ViewModel
|
||||
public ObservableCollection<ContextMenuItemViewModel> ContextMenuItems { get; } = new ObservableCollection<ContextMenuItemViewModel>();
|
||||
|
||||
public ICommand ActivateContextButtonsHoverCommand { get; set; }
|
||||
|
||||
public ICommand ActivateContextButtonsSelectionCommand { get; set; }
|
||||
|
||||
public ICommand DeactivateContextButtonsHoverCommand { get; set; }
|
||||
|
||||
public ICommand DeactivateContextButtonsSelectionCommand { get; set; }
|
||||
@@ -61,6 +67,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
ActivateContextButtons(ActivationType.Selection);
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -84,7 +91,6 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DeactivateContextButtonsHoverAction(object sender)
|
||||
{
|
||||
DeactivateContextButtons(ActivationType.Hover);
|
||||
@@ -118,7 +124,6 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadContextMenu()
|
||||
{
|
||||
var results = PluginManager.GetContextMenusForPlugin(Result);
|
||||
@@ -142,7 +147,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
if (hideWindow)
|
||||
{
|
||||
//TODO - Do we hide the window
|
||||
// TODO - Do we hide the window
|
||||
// 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()
|
||||
{
|
||||
if (ContextMenuSelectedIndex == (ContextMenuItems.Count - 1))
|
||||
@@ -204,7 +209,7 @@ namespace PowerLauncher.ViewModel
|
||||
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()
|
||||
{
|
||||
if (ContextMenuSelectedIndex == NoSelectionIndex)
|
||||
|
||||
@@ -1,184 +1,190 @@
|
||||
using PowerLauncher.Helper;
|
||||
using System;
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
{
|
||||
public class ResultsViewModel : BaseModel
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
public ResultCollection Results { get; }
|
||||
|
||||
private readonly object _collectionLock = new object();
|
||||
private readonly Settings _settings;
|
||||
// private int MaxResults => _settings?.MaxResultsToShow ?? 6;
|
||||
|
||||
public ResultsViewModel()
|
||||
{
|
||||
Results = new ResultCollection();
|
||||
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
|
||||
}
|
||||
public ResultsViewModel(Settings settings) : this()
|
||||
{
|
||||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
_settings.PropertyChanged += (s, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(_settings.MaxResultsToShow))
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
OnPropertyChanged(nameof(MaxHeight));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int MaxHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.MaxResultsToShow * 75;
|
||||
}
|
||||
}
|
||||
public int SelectedIndex { get; set; }
|
||||
|
||||
private ResultViewModel _selectedItem;
|
||||
public ResultViewModel SelectedItem
|
||||
{
|
||||
get { return _selectedItem; }
|
||||
set
|
||||
{
|
||||
//value can be null when selecting an item in a virtualized list
|
||||
if (value != null)
|
||||
{
|
||||
if (_selectedItem != null)
|
||||
{
|
||||
_selectedItem.DeactivateContextButtons(ResultViewModel.ActivationType.Selection);
|
||||
}
|
||||
|
||||
_selectedItem = value;
|
||||
_selectedItem.ActivateContextButtons(ResultViewModel.ActivationType.Selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedItem = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Thickness Margin { get; set; }
|
||||
public Visibility Visibility { get; set; } = Visibility.Hidden;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static int InsertIndexOf(int newScore, IList<ResultViewModel> list)
|
||||
{
|
||||
int index = 0;
|
||||
for (; index < list.Count; index++)
|
||||
{
|
||||
var result = list[index];
|
||||
if (newScore > result.Result.Score)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private int NewIndex(int i)
|
||||
{
|
||||
var n = Results.Count;
|
||||
if (n > 0)
|
||||
{
|
||||
i = (n + i) % n;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SelectedIndex returns -1 if selection is empty.
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void SelectNextResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex + 1);
|
||||
}
|
||||
|
||||
public void SelectPrevResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex - 1);
|
||||
}
|
||||
|
||||
public void SelectNextPage()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex + _settings.MaxResultsToShow);
|
||||
}
|
||||
|
||||
public void SelectPrevPage()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex - _settings.MaxResultsToShow);
|
||||
}
|
||||
|
||||
public void SelectFirstResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(0);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Results.Clear();
|
||||
}
|
||||
|
||||
public void RemoveResultsExcept(PluginMetadata metadata)
|
||||
{
|
||||
Results.RemoveAll(r => r.Result.PluginID != metadata.ID);
|
||||
}
|
||||
|
||||
public void RemoveResultsFor(PluginMetadata metadata)
|
||||
{
|
||||
Results.RemoveAll(r => r.Result.PluginID == metadata.ID);
|
||||
}
|
||||
|
||||
public void SelectNextTabItem()
|
||||
{
|
||||
//Do nothing if there is no selected item or we've selected the next context button
|
||||
if (!SelectedItem?.SelectNextContextButton() ?? true)
|
||||
{
|
||||
SelectNextResult();
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectPrevTabItem()
|
||||
{
|
||||
//Do nothing if there is no selected item or we've selected the previous context button
|
||||
if (!SelectedItem?.SelectPrevContextButton() ?? true)
|
||||
{
|
||||
//Tabbing backwards should highlight the last item of the previous row
|
||||
SelectPrevResult();
|
||||
SelectedItem.SelectLastContextButton();
|
||||
}
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using PowerLauncher.Helper;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
{
|
||||
public class ResultsViewModel : BaseModel
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
public ResultCollection Results { get; }
|
||||
|
||||
private readonly object _collectionLock = new object();
|
||||
private readonly Settings _settings;
|
||||
// private int MaxResults => _settings?.MaxResultsToShow ?? 6;
|
||||
|
||||
public ResultsViewModel()
|
||||
{
|
||||
Results = new ResultCollection();
|
||||
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
|
||||
}
|
||||
|
||||
public ResultsViewModel(Settings settings) : this()
|
||||
{
|
||||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
_settings.PropertyChanged += (s, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(_settings.MaxResultsToShow))
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
OnPropertyChanged(nameof(MaxHeight));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int MaxHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.MaxResultsToShow * 75;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelectedIndex { get; set; }
|
||||
|
||||
private ResultViewModel _selectedItem;
|
||||
|
||||
public ResultViewModel SelectedItem
|
||||
{
|
||||
get { return _selectedItem; }
|
||||
|
||||
set
|
||||
{
|
||||
// value can be null when selecting an item in a virtualized list
|
||||
if (value != null)
|
||||
{
|
||||
if (_selectedItem != null)
|
||||
{
|
||||
_selectedItem.DeactivateContextButtons(ResultViewModel.ActivationType.Selection);
|
||||
}
|
||||
|
||||
_selectedItem = value;
|
||||
_selectedItem.ActivateContextButtons(ResultViewModel.ActivationType.Selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedItem = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Thickness Margin { get; set; }
|
||||
|
||||
public Visibility Visibility { get; set; } = Visibility.Hidden;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static int InsertIndexOf(int newScore, IList<ResultViewModel> list)
|
||||
{
|
||||
int index = 0;
|
||||
for (; index < list.Count; index++)
|
||||
{
|
||||
var result = list[index];
|
||||
if (newScore > result.Result.Score)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private int NewIndex(int i)
|
||||
{
|
||||
var n = Results.Count;
|
||||
if (n > 0)
|
||||
{
|
||||
i = (n + i) % n;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SelectedIndex returns -1 if selection is empty.
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void SelectNextResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex + 1);
|
||||
}
|
||||
|
||||
public void SelectPrevResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex - 1);
|
||||
}
|
||||
|
||||
public void SelectNextPage()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex + _settings.MaxResultsToShow);
|
||||
}
|
||||
|
||||
public void SelectPrevPage()
|
||||
{
|
||||
SelectedIndex = NewIndex(SelectedIndex - _settings.MaxResultsToShow);
|
||||
}
|
||||
|
||||
public void SelectFirstResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(0);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Results.Clear();
|
||||
}
|
||||
|
||||
public void RemoveResultsExcept(PluginMetadata metadata)
|
||||
{
|
||||
Results.RemoveAll(r => r.Result.PluginID != metadata.ID);
|
||||
}
|
||||
|
||||
public void RemoveResultsFor(PluginMetadata metadata)
|
||||
{
|
||||
Results.RemoveAll(r => r.Result.PluginID == metadata.ID);
|
||||
}
|
||||
|
||||
public void SelectNextTabItem()
|
||||
{
|
||||
// Do nothing if there is no selected item or we've selected the next context button
|
||||
if (!SelectedItem?.SelectNextContextButton() ?? true)
|
||||
{
|
||||
SelectNextResult();
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectPrevTabItem()
|
||||
{
|
||||
// Do nothing if there is no selected item or we've selected the previous context button
|
||||
if (!SelectedItem?.SelectPrevContextButton() ?? true)
|
||||
{
|
||||
// Tabbing backwards should highlight the last item of the previous row
|
||||
SelectPrevResult();
|
||||
SelectedItem.SelectLastContextButton();
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectNextContextMenuItem()
|
||||
@@ -190,16 +196,16 @@ namespace PowerLauncher.ViewModel
|
||||
SelectedItem.SelectLastContextButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SelectPreviousContextMenuItem()
|
||||
{
|
||||
if (SelectedItem != null)
|
||||
{
|
||||
SelectedItem.SelectPrevContextButton();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool IsContextMenuItemSelected()
|
||||
{
|
||||
if (SelectedItem != null && SelectedItem.ContextMenuSelectedIndex != ResultViewModel.NoSelectionIndex)
|
||||
@@ -210,12 +216,12 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add new results to ResultCollection
|
||||
/// </summary>
|
||||
public void AddResults(List<Result> newRawResults, string resultId, CancellationToken ct)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add new results to ResultCollection
|
||||
/// </summary>
|
||||
public void AddResults(List<Result> newRawResults, string resultId, CancellationToken ct)
|
||||
{
|
||||
if (newRawResults == null)
|
||||
{
|
||||
@@ -230,44 +236,43 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
|
||||
Results.RemoveAll(r => r.Result.PluginID == resultId);
|
||||
Results.AddRange(newResults);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region FormattedText Dependency Property
|
||||
public static readonly DependencyProperty FormattedTextProperty = DependencyProperty.RegisterAttached(
|
||||
"FormattedText",
|
||||
typeof(Inline),
|
||||
typeof(ResultsViewModel),
|
||||
new PropertyMetadata(null, FormattedTextPropertyChanged));
|
||||
|
||||
public static void SetFormattedText(DependencyObject textBlock, IList<int> value)
|
||||
{
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.SetValue(FormattedTextProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Inline GetFormattedText(DependencyObject textBlock)
|
||||
{
|
||||
return (Inline)textBlock?.GetValue(FormattedTextProperty);
|
||||
}
|
||||
|
||||
private static void FormattedTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var textBlock = d as TextBlock;
|
||||
if (textBlock == null) return;
|
||||
|
||||
var inline = (Inline)e.NewValue;
|
||||
|
||||
textBlock.Inlines.Clear();
|
||||
if (inline == null) return;
|
||||
|
||||
textBlock.Inlines.Add(inline);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Results.AddRange(newResults);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region FormattedText Dependency Property
|
||||
public static readonly DependencyProperty FormattedTextProperty = DependencyProperty.RegisterAttached(
|
||||
"FormattedText",
|
||||
typeof(Inline),
|
||||
typeof(ResultsViewModel),
|
||||
new PropertyMetadata(null, FormattedTextPropertyChanged));
|
||||
|
||||
public static void SetFormattedText(DependencyObject textBlock, IList<int> value)
|
||||
{
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.SetValue(FormattedTextProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Inline GetFormattedText(DependencyObject textBlock)
|
||||
{
|
||||
return (Inline)textBlock?.GetValue(FormattedTextProperty);
|
||||
}
|
||||
|
||||
private static void FormattedTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var textBlock = d as TextBlock;
|
||||
if (textBlock == null) return;
|
||||
|
||||
var inline = (Inline)e.NewValue;
|
||||
|
||||
textBlock.Inlines.Clear();
|
||||
if (inline == null) return;
|
||||
|
||||
textBlock.Inlines.Add(inline);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 Wox.Core.Resource;
|
||||
using Wox.Infrastructure.Storage;
|
||||
@@ -30,7 +34,7 @@ namespace PowerLauncher.ViewModel
|
||||
_storage.Save();
|
||||
}
|
||||
|
||||
#region general
|
||||
#region general
|
||||
|
||||
private static Internationalization _translater => InternationalizationManager.Instance;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -8,8 +12,11 @@
|
||||
public class SpecialKeyState
|
||||
{
|
||||
public bool CtrlPressed { get; set; }
|
||||
|
||||
public bool ShiftPressed { get; set; }
|
||||
|
||||
public bool AltPressed { get; set; }
|
||||
|
||||
public bool WinPressed { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -18,4 +22,4 @@
|
||||
|| language.ToUpper() == Executable.ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Wox.Plugin
|
||||
@@ -16,4 +18,4 @@ namespace Wox.Plugin
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
|
||||
public class ContextMenuResult
|
||||
{
|
||||
public string PluginName { get; set; }
|
||||
@@ -28,4 +31,4 @@ namespace Wox.Plugin
|
||||
return Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e);
|
||||
|
||||
public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e);
|
||||
|
||||
public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e);
|
||||
@@ -11,6 +16,7 @@ namespace Wox.Plugin
|
||||
public class WoxKeyDownEventArgs
|
||||
{
|
||||
public string Query { get; set; }
|
||||
|
||||
public KeyEventArgs keyEventArgs { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -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.Specialized;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -6,4 +10,4 @@ namespace Wox.Plugin.Features
|
||||
"and use Wox.Plugin.Feature.IContextMenu instead, " +
|
||||
"this method will be removed in v1.3.0")]
|
||||
public interface IContextMenu { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -6,4 +10,4 @@ namespace Wox.Plugin.Features
|
||||
"and use Wox.Plugin.Feature.IInstantQuery instead, " +
|
||||
"this method will be removed in v1.3.0")]
|
||||
public interface IInstantQuery { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
public interface IPlugin
|
||||
{
|
||||
List<Result> Query(Query query);
|
||||
|
||||
void Init(PluginInitContext context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -12,7 +16,7 @@ namespace Wox.Plugin
|
||||
/// </summary>
|
||||
/// <param name="query">query text</param>
|
||||
/// <param name="requery">
|
||||
/// force requery By default, Wox will not fire query if your query is same with existing one.
|
||||
/// force requery By default, Wox will not fire query if your query is same with existing one.
|
||||
/// Set this to true to force Wox requerying
|
||||
/// </param>
|
||||
void ChangeQuery(string query, bool requery = false);
|
||||
@@ -38,7 +42,7 @@ namespace Wox.Plugin
|
||||
void SaveAppAllSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Reloads any Plugins that have the
|
||||
/// Reloads any Plugins that have the
|
||||
/// IReloadable implemented. It refreshes
|
||||
/// Plugin's in memory data with new content
|
||||
/// added by user.
|
||||
@@ -73,7 +77,7 @@ namespace Wox.Plugin
|
||||
string GetTranslation(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Get all loaded plugins
|
||||
/// Get all loaded plugins
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<PluginPair> GetAllPlugins();
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public interface ISettingProvider
|
||||
{
|
||||
Control CreateSettingPanel();
|
||||
void UpdateSettings(PowerLauncherSettings settings);
|
||||
}
|
||||
}
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Lib;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public interface ISettingProvider
|
||||
{
|
||||
Control CreateSettingPanel();
|
||||
|
||||
void UpdateSettings(PowerLauncherSettings settings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
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>
|
||||
/// This interface is to indicate and allow plugins to reload their
|
||||
/// in memory data cache or other mediums when user makes a new change
|
||||
/// that is not immediately captured. For example, for BrowserBookmark and Program
|
||||
/// plugin does not automatically detect when a user added a new bookmark or program,
|
||||
/// so this interface's function is exposed to allow user manually do the reloading after
|
||||
/// so this interface's function is exposed to allow user manually do the reloading after
|
||||
/// those new additions.
|
||||
///
|
||||
///
|
||||
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
|
||||
/// it will call the plugins that have implemented this interface.
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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.IO;
|
||||
using Newtonsoft.Json;
|
||||
@@ -9,14 +13,23 @@ namespace Wox.Plugin
|
||||
public class PluginMetadata : BaseModel
|
||||
{
|
||||
private string _pluginDirectory;
|
||||
|
||||
public string ID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Author { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
|
||||
public string Language { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Website { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public string ExecuteFilePath { get; private set; }
|
||||
|
||||
public string ExecuteFileName { get; set; }
|
||||
@@ -24,6 +37,7 @@ namespace Wox.Plugin
|
||||
public string PluginDirectory
|
||||
{
|
||||
get { return _pluginDirectory; }
|
||||
|
||||
internal set
|
||||
{
|
||||
_pluginDirectory = value;
|
||||
@@ -51,8 +65,10 @@ namespace Wox.Plugin
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long InitTime { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public long AvgQueryTime { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int QueryCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -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 IPlugin Plugin { get; internal set; }
|
||||
|
||||
public PluginMetadata Metadata { get; internal set; }
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
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("Wox")]
|
||||
[assembly: InternalsVisibleTo("Wox.Core")]
|
||||
[assembly: InternalsVisibleTo("Wox.Test")]
|
||||
[assembly: InternalsVisibleTo("Wox.Test")]
|
||||
|
||||
@@ -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.Linq;
|
||||
|
||||
@@ -28,7 +32,7 @@ namespace Wox.Plugin
|
||||
/// <summary>
|
||||
/// Search part of a query.
|
||||
/// This will not include action keyword if exclusive plugin gets it, otherwise it should be same as RawQuery.
|
||||
/// Since we allow user to switch a exclusive plugin to generic plugin,
|
||||
/// Since we allow user to switch a exclusive plugin to generic plugin,
|
||||
/// so this property will always give you the "real" query part of the query
|
||||
/// </summary>
|
||||
public string Search { get; internal set; }
|
||||
|
||||
@@ -1,161 +1,169 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
private string _title;
|
||||
private ToolTipData _toolTipData;
|
||||
private string _pluginDirectory;
|
||||
private string _icoPath;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
|
||||
public class Result
|
||||
{
|
||||
|
||||
private string _title;
|
||||
private ToolTipData _toolTipData;
|
||||
private string _pluginDirectory;
|
||||
private string _icoPath;
|
||||
public string Title
|
||||
{
|
||||
get { return _title; }
|
||||
|
||||
set
|
||||
{
|
||||
_title = value.Replace("\n", " ");
|
||||
}
|
||||
}
|
||||
public string SubTitle { get; set; }
|
||||
|
||||
public string Glyph { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public string SubTitle { get; set; }
|
||||
|
||||
public string Glyph { get; set; }
|
||||
|
||||
public string FontFamily { get; set; }
|
||||
|
||||
public Visibility ToolTipVisibility { get; set; } = Visibility.Collapsed;
|
||||
|
||||
|
||||
public ToolTipData ToolTipData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _toolTipData;
|
||||
}
|
||||
set
|
||||
{
|
||||
_toolTipData = value;
|
||||
ToolTipVisibility = Visibility.Visible;
|
||||
return _toolTipData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set
|
||||
{
|
||||
_toolTipData = value;
|
||||
ToolTipVisibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text that will get displayed in the Search text box, when this item is selected in the result list.
|
||||
/// </summary>
|
||||
public string QueryTextDisplay { get; set; }
|
||||
|
||||
public string IcoPath
|
||||
{
|
||||
get { return _icoPath; }
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value))
|
||||
{
|
||||
_icoPath = Path.Combine(value, IcoPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
_icoPath = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate ImageSource IconDelegate();
|
||||
|
||||
public IconDelegate Icon;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// return true to hide wox after select result
|
||||
/// </summary>
|
||||
public Func<ActionContext, bool> Action { get; set; }
|
||||
|
||||
public int Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of indexes for the characters to be highlighted in Title
|
||||
/// </summary>
|
||||
public IList<int> TitleHighlightData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of indexes for the characters to be highlighted in SubTitle
|
||||
/// </summary>
|
||||
public IList<int> SubTitleHighlightData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only results that originQuery match with current query will be displayed in the panel
|
||||
/// </summary>
|
||||
internal Query OriginQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Plugin directory
|
||||
/// </summary>
|
||||
public string PluginDirectory
|
||||
{
|
||||
get { return _pluginDirectory; }
|
||||
set
|
||||
{
|
||||
_pluginDirectory = value;
|
||||
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath))
|
||||
{
|
||||
IcoPath = Path.Combine(value, IcoPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var r = obj as Result;
|
||||
|
||||
var equality = string.Equals(r?.Title, Title) &&
|
||||
string.Equals(r?.SubTitle, SubTitle) &&
|
||||
string.Equals(r?.IcoPath, IcoPath) &&
|
||||
TitleHighlightData == r.TitleHighlightData &&
|
||||
SubTitleHighlightData == r.SubTitleHighlightData;
|
||||
|
||||
return equality;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var hashcode = (Title?.GetHashCode() ?? 0) ^
|
||||
(SubTitle?.GetHashCode() ?? 0);
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title + SubTitle;
|
||||
}
|
||||
|
||||
[Obsolete("Use IContextMenu instead")]
|
||||
/// <summary>
|
||||
/// Context menus associate with this result
|
||||
/// </summary>
|
||||
public List<Result> ContextMenu { get; set; }
|
||||
|
||||
[Obsolete("Use Object initializers instead")]
|
||||
public Result(string Title, string IcoPath, string SubTitle = null)
|
||||
{
|
||||
this.Title = Title;
|
||||
this.IcoPath = IcoPath;
|
||||
this.SubTitle = SubTitle;
|
||||
}
|
||||
|
||||
public Result() { }
|
||||
|
||||
/// <summary>
|
||||
/// Additional data associate with this result
|
||||
/// </summary>
|
||||
public object ContextData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Plugin ID that generated this result
|
||||
/// </summary>
|
||||
public string PluginID { get; internal set; }
|
||||
}
|
||||
}
|
||||
/// </summary>
|
||||
public string QueryTextDisplay { get; set; }
|
||||
|
||||
public string IcoPath
|
||||
{
|
||||
get { return _icoPath; }
|
||||
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value))
|
||||
{
|
||||
_icoPath = Path.Combine(value, IcoPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
_icoPath = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate ImageSource IconDelegate();
|
||||
|
||||
public IconDelegate Icon;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// return true to hide wox after select result
|
||||
/// </summary>
|
||||
public Func<ActionContext, bool> Action { get; set; }
|
||||
|
||||
public int Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of indexes for the characters to be highlighted in Title
|
||||
/// </summary>
|
||||
public IList<int> TitleHighlightData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of indexes for the characters to be highlighted in SubTitle
|
||||
/// </summary>
|
||||
public IList<int> SubTitleHighlightData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only results that originQuery match with current query will be displayed in the panel
|
||||
/// </summary>
|
||||
internal Query OriginQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Plugin directory
|
||||
/// </summary>
|
||||
public string PluginDirectory
|
||||
{
|
||||
get { return _pluginDirectory; }
|
||||
|
||||
set
|
||||
{
|
||||
_pluginDirectory = value;
|
||||
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath))
|
||||
{
|
||||
IcoPath = Path.Combine(value, IcoPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var r = obj as Result;
|
||||
|
||||
var equality = string.Equals(r?.Title, Title) &&
|
||||
string.Equals(r?.SubTitle, SubTitle) &&
|
||||
string.Equals(r?.IcoPath, IcoPath) &&
|
||||
TitleHighlightData == r.TitleHighlightData &&
|
||||
SubTitleHighlightData == r.SubTitleHighlightData;
|
||||
|
||||
return equality;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var hashcode = (Title?.GetHashCode() ?? 0) ^
|
||||
(SubTitle?.GetHashCode() ?? 0);
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title + SubTitle;
|
||||
}
|
||||
|
||||
[Obsolete("Use IContextMenu instead")]
|
||||
/// <summary>
|
||||
/// Context menus associate with this result
|
||||
/// </summary>
|
||||
public List<Result> ContextMenu { get; set; }
|
||||
|
||||
[Obsolete("Use Object initializers instead")]
|
||||
public Result(string Title, string IcoPath, string SubTitle = null)
|
||||
{
|
||||
this.Title = Title;
|
||||
this.IcoPath = IcoPath;
|
||||
this.SubTitle = SubTitle;
|
||||
}
|
||||
|
||||
public Result() { }
|
||||
|
||||
/// <summary>
|
||||
/// Additional data associate with this result
|
||||
/// </summary>
|
||||
public object ContextData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Plugin ID that generated this result
|
||||
/// </summary>
|
||||
public string PluginID { get; internal set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Windows;
|
||||
|
||||
|
||||
@@ -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.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -7,8 +11,8 @@ namespace Wox.Plugin.SharedCommands
|
||||
{
|
||||
public static class SearchWeb
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
||||
/// <summary>
|
||||
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
||||
/// Leave browser path blank to use Chrome.
|
||||
/// </summary>
|
||||
public static void NewBrowserWindow(this string url, string browserPath)
|
||||
@@ -37,7 +41,7 @@ namespace Wox.Plugin.SharedCommands
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Opens search as a tab in the default browser chosen in Windows settings.
|
||||
/// </summary>
|
||||
public static void NewTabInBrowser(this string url, string browserPath)
|
||||
@@ -53,6 +57,7 @@ namespace Wox.Plugin.SharedCommands
|
||||
Process.Start(url);
|
||||
}
|
||||
}
|
||||
|
||||
// This error may be thrown for Process.Start(browserPath, url)
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
{
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
using System;
|
||||
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;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wox.Plugin.SharedCommands
|
||||
{
|
||||
public static class ShellCommand
|
||||
{
|
||||
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 int GetWindowText(IntPtr hwnd, StringBuilder lpString, int nMaxCount);
|
||||
|
||||
[DllImport("user32.dll")] static extern int GetWindowTextLength(IntPtr hwnd);
|
||||
|
||||
private static bool containsSecurityWindow;
|
||||
@@ -29,6 +33,7 @@ namespace Wox.Plugin.SharedCommands
|
||||
CheckSecurityWindow();
|
||||
Thread.Sleep(25);
|
||||
}
|
||||
|
||||
while (containsSecurityWindow) // while this process contains a "Windows Security" dialog, stay open
|
||||
{
|
||||
containsSecurityWindow = false;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using ControlzEx.Theming;
|
||||
using MahApps.Metro.Theming;
|
||||
using Microsoft.Win32;
|
||||
// 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.Linq;
|
||||
using System.Windows;
|
||||
using ControlzEx.Theming;
|
||||
using MahApps.Metro.Theming;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
@@ -142,6 +145,7 @@ namespace Wox.Plugin
|
||||
{
|
||||
currentTheme = Theme.None;
|
||||
}
|
||||
|
||||
ThemeChanged?.Invoke(oldTheme, currentTheme);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -14,6 +18,7 @@ namespace Wox.Plugin
|
||||
{
|
||||
throw new ArgumentException("title cannot be null or empty", "title");
|
||||
}
|
||||
|
||||
Title = title;
|
||||
Text = text;
|
||||
}
|
||||
|
||||
@@ -68,5 +68,19 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" />
|
||||
</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>
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -238,4 +242,4 @@ namespace Wox.Test
|
||||
Assert.IsTrue(firstScore > secondScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -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 System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -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.Infrastructure.Exception;
|
||||
|
||||
@@ -11,7 +15,7 @@ namespace Wox.Test.Plugins
|
||||
[Test]
|
||||
public void PublicAPIIsNullTest()
|
||||
{
|
||||
//Assert.Throws(typeof(WoxFatalException), () => PluginManager.Initialize(null));
|
||||
// Assert.Throws(typeof(WoxFatalException), () => PluginManager.Initialize(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using Microsoft.Search.Interop;
|
||||
|
||||
@@ -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 Wox.Core.Plugin;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -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 System;
|
||||
using System.Collections.Generic;
|
||||
@@ -41,7 +45,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
|
||||
@@ -62,7 +65,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
|
||||
@@ -91,7 +93,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
rvm.SelectNextContextMenuItem();
|
||||
@@ -115,7 +116,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
rvm.SelectPreviousContextMenuItem();
|
||||
@@ -137,7 +137,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
bool isContextMenuItemSelected = rvm.IsContextMenuItemSelected();
|
||||
@@ -159,7 +158,6 @@ namespace Wox.Test
|
||||
});
|
||||
rvm.SelectedItem = selectedItem;
|
||||
|
||||
|
||||
// Act
|
||||
rvm.SelectNextContextMenuItem();
|
||||
rvm.SelectPreviousContextMenuItem();
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using NUnit.Framework;
|
||||
//using Wox.Plugin.Url;
|
||||
// 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.Plugin.Url;
|
||||
|
||||
namespace Wox.Test
|
||||
{
|
||||
@@ -9,24 +13,23 @@ namespace Wox.Test
|
||||
[Test]
|
||||
public void URLMatchTest()
|
||||
{
|
||||
//var plugin = new Main();
|
||||
//Assert.IsTrue(plugin.IsURL("http://www.google.com"));
|
||||
//Assert.IsTrue(plugin.IsURL("https://www.google.com"));
|
||||
//Assert.IsTrue(plugin.IsURL("http://google.com"));
|
||||
//Assert.IsTrue(plugin.IsURL("www.google.com"));
|
||||
//Assert.IsTrue(plugin.IsURL("google.com"));
|
||||
//Assert.IsTrue(plugin.IsURL("http://localhost"));
|
||||
//Assert.IsTrue(plugin.IsURL("https://localhost"));
|
||||
//Assert.IsTrue(plugin.IsURL("http://localhost:80"));
|
||||
//Assert.IsTrue(plugin.IsURL("https://localhost:80"));
|
||||
//Assert.IsTrue(plugin.IsURL("http://110.10.10.10"));
|
||||
//Assert.IsTrue(plugin.IsURL("110.10.10.10"));
|
||||
//Assert.IsTrue(plugin.IsURL("ftp://110.10.10.10"));
|
||||
// var plugin = new Main();
|
||||
// Assert.IsTrue(plugin.IsURL("http://www.google.com"));
|
||||
// Assert.IsTrue(plugin.IsURL("https://www.google.com"));
|
||||
// Assert.IsTrue(plugin.IsURL("http://google.com"));
|
||||
// Assert.IsTrue(plugin.IsURL("www.google.com"));
|
||||
// Assert.IsTrue(plugin.IsURL("google.com"));
|
||||
// Assert.IsTrue(plugin.IsURL("http://localhost"));
|
||||
// Assert.IsTrue(plugin.IsURL("https://localhost"));
|
||||
// Assert.IsTrue(plugin.IsURL("http://localhost:80"));
|
||||
// Assert.IsTrue(plugin.IsURL("https://localhost:80"));
|
||||
// Assert.IsTrue(plugin.IsURL("http://110.10.10.10"));
|
||||
// Assert.IsTrue(plugin.IsURL("110.10.10.10"));
|
||||
// Assert.IsTrue(plugin.IsURL("ftp://110.10.10.10"));
|
||||
|
||||
|
||||
//Assert.IsFalse(plugin.IsURL("wwww"));
|
||||
//Assert.IsFalse(plugin.IsURL("wwww.c"));
|
||||
//Assert.IsFalse(plugin.IsURL("wwww.c"));
|
||||
// Assert.IsFalse(plugin.IsURL("wwww"));
|
||||
// Assert.IsFalse(plugin.IsURL("wwww.c"));
|
||||
// Assert.IsFalse(plugin.IsURL("wwww.c"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,5 +57,19 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||
</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>
|
||||
@@ -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 Wox.Plugin;
|
||||
using PowerLauncher.ViewModel;
|
||||
@@ -39,7 +43,6 @@ namespace Wox.Test
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AnyVariable_MustCallOnPropertyChanged_WhenSet()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user