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;
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
{

View File

@@ -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
{

View File

@@ -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
{

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.Events;

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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>

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.Resource;
using Wox.Infrastructure.Exception;
using Wox.Infrastructure.UserSettings;
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 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>

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.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();

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 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;
}

View File

@@ -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;

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.Specialized;
using PowerLauncher.ViewModel;
namespace PowerLauncher.Helper
{

View File

@@ -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);
@@ -309,7 +307,6 @@ 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

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.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
{

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
{

View File

@@ -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;
@@ -170,7 +173,7 @@ namespace PowerLauncher
{
if (_settings.HideWhenDeactivated)
{
//(this.FindResource("OutroStoryboard") as Storyboard).Begin();
// (this.FindResource("OutroStoryboard") as Storyboard).Begin();
Hide();
}
}

View File

@@ -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>

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.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()

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.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
{

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
{

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:
// 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:

View File

@@ -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;

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;
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()

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.Linq;
using Newtonsoft.Json;
using Wox.Plugin;
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 Newtonsoft.Json;
using Wox.Plugin;
@@ -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; }
}
}

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 Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
namespace PowerLauncher.Storage

View File

@@ -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)

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.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;
@@ -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)

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;
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.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)

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.Collections.Generic;
using System.Threading;
@@ -6,6 +9,7 @@ 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;
@@ -26,6 +30,7 @@ namespace PowerLauncher.ViewModel
Results = new ResultCollection();
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
}
public ResultsViewModel(Settings settings) : this()
{
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
@@ -52,15 +57,18 @@ namespace PowerLauncher.ViewModel
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
// value can be null when selecting an item in a virtualized list
if (value != null)
{
if (_selectedItem != null)
@@ -78,9 +86,8 @@ namespace PowerLauncher.ViewModel
}
}
public Thickness Margin { get; set; }
public Visibility Visibility { get; set; } = Visibility.Hidden;
#endregion
@@ -116,7 +123,6 @@ namespace PowerLauncher.ViewModel
}
}
#endregion
#region Public Methods
@@ -163,7 +169,7 @@ namespace PowerLauncher.ViewModel
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)
{
SelectNextResult();
@@ -172,10 +178,10 @@ namespace PowerLauncher.ViewModel
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)
{
//Tabbing backwards should highlight the last item of the previous row
// Tabbing backwards should highlight the last item of the previous row
SelectPrevResult();
SelectedItem.SelectLastContextButton();
}
@@ -268,6 +274,5 @@ namespace PowerLauncher.ViewModel
}
#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 Wox.Core.Resource;
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
{
@@ -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; }
}
}

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
{

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.Runtime.CompilerServices;
using System.Windows;
using JetBrains.Annotations;
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;
namespace Wox.Plugin
{
public class ContextMenuResult
{
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;
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; }
}

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.Specialized;
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
{

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
{

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
{

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
{
public interface IPlugin
{
List<Result> Query(Query query);
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
{

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 Microsoft.PowerToys.Settings.UI.Lib;
namespace Wox.Plugin
{
public interface ISettingProvider
{
Control CreateSettingPanel();
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>
/// 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
{

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.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; }
}

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

View File

@@ -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;

View File

@@ -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);
}

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

View File

@@ -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>

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.Collections.Generic;
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.Collections.Generic;
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 System;
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.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));
}
}
}

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.Collections.Generic;
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.Collections.Generic;
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.Collections.Generic;
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 Wox.Core.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 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();

View File

@@ -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"));
}
}
}

View File

@@ -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>

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 Wox.Plugin;
using PowerLauncher.ViewModel;
@@ -39,7 +43,6 @@ namespace Wox.Test
}
}
[Test]
public void AnyVariable_MustCallOnPropertyChanged_WhenSet()
{