Migrate files from Wox to PowerLauncher (#5014)

* Moved all files from Wox to Powerlauncher

* Removed Wox project

* Changed namespace for imported files

* Resolved errors for VM

* Added build dependency order

* Fixed errors in helper class

* Remove Wox files

* Fixed errors in SingleInstance class

* Fixed wox.tests

* Fixed MSI

* Removed obsolete methods from PublicAPI

* nit fixes

* Throw null exception

* Fix merge conflict
This commit is contained in:
Divyansh Srivastava 2020-07-20 11:22:03 -07:00 committed by GitHub
parent 177546bab6
commit c85cd4ac24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 587 additions and 1048 deletions

View File

@ -161,16 +161,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerCommon", "sr
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "launcher", "launcher", "{C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox", "src\modules\launcher\Wox\Wox.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}"
ProjectSection(ProjectDependencies) = postProject
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {FDB3555B-58EF-4AE6-B5F1-904719637AB4}
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E}
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}
{F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {F8B870EB-D5F5-45BA-9CF7-A5C459818820}
{74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Core", "src\modules\launcher\Wox.Core\Wox.Core.csproj", "{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Infrastructure", "src\modules\launcher\Wox.Infrastructure\Wox.Infrastructure.csproj", "{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}"
@ -200,6 +190,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Launcher", "src\m
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher", "src\modules\launcher\PowerLauncher\PowerLauncher.csproj", "{F97E5003-F263-4D4A-A964-0F1F3C82DEF2}"
ProjectSection(ProjectDependencies) = postProject
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {FDB3555B-58EF-4AE6-B5F1-904719637AB4}
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E}
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}
{F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {F8B870EB-D5F5-45BA-9CF7-A5C459818820}
{74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E775CC2C-24CB-48D6-9C3A-BE4CCE0DB17A}"
EndProject
@ -257,14 +255,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerTest", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedCommon", "src\common\ManagedCommon\ManagedCommon.csproj", "{4AED67B6-55FD-486F-B917-E543DEE2CB3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Program.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Program.UnitTests\Microsoft.Plugin.Program.UnitTests.csproj", "{42851751-CBC8-45A6-97F5-7A0753F7B4D1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ColorPicker", "src\modules\colorPicker\ColorPicker\ColorPicker.vcxproj", "{655C9AF2-18D3-4DA6-80E4-85504A7722BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPickerUI", "src\modules\colorPicker\ColorPickerUI\ColorPickerUI.csproj", "{BA58206B-1493-4C75-BFEA-A85768A1E156}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "colorpicker", "colorpicker", "{1D78B84B-CA39-406C-98F4-71F7EC266CC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Plugin.Program.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Program.UnitTests\Microsoft.Plugin.Program.UnitTests.csproj", "{42851751-CBC8-45A6-97F5-7A0753F7B4D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -375,10 +373,6 @@ Global
{8AFFA899-0B73-49EC-8C50-0FADDA57B2FC}.Debug|x64.Build.0 = Debug|x64
{8AFFA899-0B73-49EC-8C50-0FADDA57B2FC}.Release|x64.ActiveCfg = Release|x64
{8AFFA899-0B73-49EC-8C50-0FADDA57B2FC}.Release|x64.Build.0 = Release|x64
{DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x64.ActiveCfg = Debug|x64
{DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x64.Build.0 = Debug|x64
{DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x64.ActiveCfg = Release|x64
{DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x64.Build.0 = Release|x64
{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|x64.ActiveCfg = Debug|x64
{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|x64.Build.0 = Debug|x64
{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Release|x64.ActiveCfg = Release|x64
@ -511,6 +505,10 @@ Global
{4AED67B6-55FD-486F-B917-E543DEE2CB3C}.Debug|x64.Build.0 = Debug|x64
{4AED67B6-55FD-486F-B917-E543DEE2CB3C}.Release|x64.ActiveCfg = Release|x64
{4AED67B6-55FD-486F-B917-E543DEE2CB3C}.Release|x64.Build.0 = Release|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Debug|x64.ActiveCfg = Debug|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Debug|x64.Build.0 = Debug|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Release|x64.ActiveCfg = Release|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Release|x64.Build.0 = Release|x64
{655C9AF2-18D3-4DA6-80E4-85504A7722BA}.Debug|x64.ActiveCfg = Debug|x64
{655C9AF2-18D3-4DA6-80E4-85504A7722BA}.Debug|x64.Build.0 = Debug|x64
{655C9AF2-18D3-4DA6-80E4-85504A7722BA}.Release|x64.ActiveCfg = Release|x64
@ -519,10 +517,6 @@ Global
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Debug|x64.Build.0 = Debug|x64
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Release|x64.ActiveCfg = Release|x64
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Release|x64.Build.0 = Release|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Debug|x64.ActiveCfg = Debug|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Debug|x64.Build.0 = Debug|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Release|x64.ActiveCfg = Release|x64
{42851751-CBC8-45A6-97F5-7A0753F7B4D1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -557,7 +551,6 @@ Global
{38BDB927-829B-4C65-9CD9-93FB05D66D65} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{8AFFA899-0B73-49EC-8C50-0FADDA57B2FC} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
{C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{DB90F671-D861-46BB-93A3-F1304F5BA1C5} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
{8451ECDD-2EA4-4966-BB0A-7BBC40138E80} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
@ -593,10 +586,10 @@ Global
{E6410BFC-B341-498C-8C67-312C20CDD8D5} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{62173D9A-6724-4C00-A1C8-FB646480A9EC} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
{4AED67B6-55FD-486F-B917-E543DEE2CB3C} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{42851751-CBC8-45A6-97F5-7A0753F7B4D1} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{655C9AF2-18D3-4DA6-80E4-85504A7722BA} = {1D78B84B-CA39-406C-98F4-71F7EC266CC0}
{BA58206B-1493-4C75-BFEA-A85768A1E156} = {1D78B84B-CA39-406C-98F4-71F7EC266CC0}
{1D78B84B-CA39-406C-98F4-71F7EC266CC0} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{42851751-CBC8-45A6-97F5-7A0753F7B4D1} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@ -803,7 +803,7 @@
<ComponentGroup Id="LauncherComponents">
<Component Id="launcherInstallComponent" Directory="LauncherInstallFolder" Guid="5E688DB4-C522-4268-BA54-ED1CDFFE9DB6">
<File Source="$(var.BinX64Dir)modules\Launcher\Microsoft.Launcher.dll" />
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;Pinyin4Net.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;WindowsInput.dll;Wox.Core.dll;Wox.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;PropertyChanged.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;MahApps.Metro.dll;ManagedCommon.dll?>
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;Pinyin4Net.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;WindowsInput.dll;Wox.Core.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;PropertyChanged.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;MahApps.Metro.dll;ManagedCommon.dll?>
<File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\$(var.File)" />
<?endforeach?>
<File Source="$(var.BinX64Dir)SettingsUIRunner\Microsoft.PowerToys.Settings.UI.Lib.dll" />

View File

@ -11,14 +11,14 @@ using Wox;
using Wox.Core;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Helper;
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 Wox.ViewModel;
using PowerLauncher.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch;
namespace PowerLauncher

View File

@ -2,7 +2,7 @@
using System.IO;
using System.Net;
namespace Wox.Helper
namespace PowerLauncher.Helper
{
public class DataWebRequestFactory : IWebRequestCreate
{
@ -30,7 +30,7 @@ namespace Wox.Helper
{
string uriString = uri.AbsoluteUri;
int commaIndex = uriString.IndexOf(',');
int commaIndex = uriString.IndexOf(',', StringComparison.InvariantCultureIgnoreCase);
var headers = uriString.Substring(0, commaIndex).Split(';');
m_contentType = headers[0];
string dataString = uriString.Substring(commaIndex + 1);

View File

@ -4,29 +4,32 @@ using NLog;
using Wox.Infrastructure;
using Wox.Infrastructure.Exception;
namespace Wox.Helper
namespace PowerLauncher.Helper
{
public static class ErrorReporting
{
private static void Report(Exception e)
{
var logger = LogManager.GetLogger("UnHandledException");
logger.Fatal(ExceptionFormatter.FormatException(e));
var reportWindow = new ReportWindow(e);
reportWindow.Show();
if( e != null)
{
var logger = LogManager.GetLogger("UnHandledException");
logger.Fatal(ExceptionFormatter.FormatException(e));
var reportWindow = new ReportWindow(e);
reportWindow.Show();
}
}
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
{
//handle non-ui thread exceptions
Report((Exception)e.ExceptionObject);
Report((Exception)e?.ExceptionObject);
}
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
//handle ui thread exceptions
Report(e.Exception);
Report(e?.Exception);
//prevent application exist, so the user can copy prompted error info
e.Handled = true;
}

View File

@ -4,7 +4,7 @@ using System.Text;
using System.Windows.Input;
using Wox.Plugin;
namespace Wox.Helper
namespace PowerLauncher.Helper
{
class KeyboardHelper
{

View File

@ -0,0 +1,70 @@
using PowerLauncher.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace PowerLauncher.Helper
{
public class ResultCollection : ObservableCollection<ResultViewModel>
{
public void RemoveAll(Predicate<ResultViewModel> predicate)
{
CheckReentrancy();
for (int i = Count - 1; i >= 0; i--)
{
if (predicate(this[i]))
{
RemoveAt(i);
}
}
}
/// <summary>
/// Update the results collection with new results, try to keep identical results
/// </summary>
/// <param name="newItems"></param>
public void Update(List<ResultViewModel> newItems)
{
if(newItems == null)
{
throw new ArgumentNullException(nameof(newItems));
}
int newCount = newItems.Count;
int oldCount = Items.Count;
int location = newCount > oldCount ? oldCount : newCount;
for (int i = 0; i < location; i++)
{
ResultViewModel oldResult = this[i];
ResultViewModel newResult = newItems[i];
if (!oldResult.Equals(newResult))
{ // result is not the same update it in the current index
this[i] = newResult;
}
else if (oldResult.Result.Score != newResult.Result.Score)
{
this[i].Result.Score = newResult.Result.Score;
}
}
if (newCount >= oldCount)
{
for (int i = oldCount; i < newCount; i++)
{
Add(newItems[i]);
}
}
else
{
for (int i = oldCount - 1; i >= newCount; i--)
{
RemoveAt(i);
}
}
}
}
}

View File

@ -12,10 +12,11 @@ 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/
// modified to allow single instance restart
namespace Wox.Helper
namespace PowerLauncher.Helper
{
internal enum WM
{
@ -147,8 +148,34 @@ namespace Wox.Helper
[DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)]
private static extern IntPtr _LocalFree(IntPtr hMem);
internal static extern IntPtr _LocalFree(IntPtr hMem);
[DllImport("user32.dll")]
internal static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
[DllImport("user32.dll", SetLastError = true)]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
internal static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
internal static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
internal static extern IntPtr GetShellWindow();
[DllImport("user32.dll", SetLastError = true)]
internal static extern int GetWindowRect(IntPtr hwnd, out RECT rc);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.DLL", CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
public static string[] CommandLineToArgvW(string cmdLine)
{
@ -233,7 +260,7 @@ namespace Wox.Helper
/// If not, activates the first instance.
/// </summary>
/// <returns>True if this is the first instance of the application.</returns>
public static bool InitializeAsFirstInstance( string uniqueName )
internal static bool InitializeAsFirstInstance( string uniqueName )
{
// Build unique application Id and the IPC channel name.
string applicationIdentifier = uniqueName + Environment.UserName;
@ -258,7 +285,7 @@ namespace Wox.Helper
/// <summary>
/// Cleans up single-instance code, clearing shared resources, mutexes, etc.
/// </summary>
public static void Cleanup()
internal static void Cleanup()
{
singleInstanceMutex?.ReleaseMutex();
}
@ -311,7 +338,7 @@ namespace Wox.Helper
if (args == null)
{
args = new string[] { };
args = Array.Empty<string>();
}
return new List<string>(args);
@ -329,7 +356,7 @@ namespace Wox.Helper
while(true)
{
// Wait for connection to the pipe
await pipeServer.WaitForConnectionAsync();
await pipeServer.WaitForConnectionAsync().ConfigureAwait(false);
if (Application.Current != null)
{
// Do an asynchronous call to ActivateFirstInstance function
@ -354,7 +381,7 @@ namespace Wox.Helper
using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", channelName, PipeDirection.Out))
{
// Connect to the available pipe
await pipeClient.ConnectAsync(0);
await pipeClient.ConnectAsync(0).ConfigureAwait(false);
}
}
@ -363,7 +390,7 @@ namespace Wox.Helper
/// </summary>
/// <param name="arg">Callback argument.</param>
/// <returns>Always null.</returns>
private static object ActivateFirstInstanceCallback(object o)
private static object ActivateFirstInstanceCallback(object _)
{
ActivateFirstInstance();
return null;
@ -385,27 +412,5 @@ namespace Wox.Helper
}
#endregion
#region Private Classes
/// <summary>
/// Remoting service class which is exposed by the server i.e the first instance and called by the second instance
/// to pass on the command line arguments to the first instance and cause it to activate itself.
/// </summary>
private class IPCRemoteService : MarshalByRefObject
{
/// <summary>
/// Remoting Object's ease expires after every 5 minutes by default. We need to override the InitializeLifetimeService class
/// to ensure that lease never expires.
/// </summary>
/// <returns>Always null.</returns>
public override object InitializeLifetimeService()
{
return null;
}
}
#endregion
}
}

View File

@ -8,9 +8,9 @@ using System.Windows.Interop;
using System.Windows.Media;
using Point = System.Windows.Point;
namespace Wox.Helper
namespace PowerLauncher.Helper
{
public class WindowsInteropHelper
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
@ -23,22 +23,20 @@ namespace Wox.Helper
{
get
{
return _hwnd_shell != IntPtr.Zero ? _hwnd_shell : _hwnd_shell = GetShellWindow();
return _hwnd_shell != IntPtr.Zero ? _hwnd_shell : _hwnd_shell = NativeMethods.GetShellWindow();
}
}
private static IntPtr HWND_DESKTOP
{
get
{
return _hwnd_desktop != IntPtr.Zero ? _hwnd_desktop : _hwnd_desktop = GetDesktopWindow();
return _hwnd_desktop != IntPtr.Zero ? _hwnd_desktop : _hwnd_desktop = NativeMethods.GetDesktopWindow();
}
}
[DllImport("user32.dll")]
public static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
[StructLayout(LayoutKind.Sequential)]
public struct INPUT
internal struct INPUT
{
public INPUTTYPE type;
public InputUnion data;
@ -50,7 +48,7 @@ namespace Wox.Helper
}
[StructLayout(LayoutKind.Explicit)]
public struct InputUnion
internal struct InputUnion
{
[FieldOffset(0)]
internal MOUSEINPUT mi;
@ -89,38 +87,13 @@ namespace Wox.Helper
internal short wParamH;
}
public enum INPUTTYPE : uint
internal enum INPUTTYPE : uint
{
INPUT_MOUSE = 0,
INPUT_KEYBOARD = 1,
INPUT_HARDWARE = 2,
INPUTMOUSE = 0,
INPUTKEYBOARD = 1,
INPUTHARDWARE = 2,
}
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
private static extern IntPtr GetShellWindow();
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowRect(IntPtr hwnd, out RECT rc);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.DLL")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
const string WINDOW_CLASS_CONSOLE = "ConsoleWindowClass";
const string WINDOW_CLASS_WINTAB = "Flip3D";
const string WINDOW_CLASS_PROGMAN = "Progman";
@ -129,7 +102,7 @@ namespace Wox.Helper
public static bool IsWindowFullscreen()
{
//get current active window
IntPtr hWnd = GetForegroundWindow();
IntPtr hWnd = NativeMethods.GetForegroundWindow();
if (hWnd != null && !hWnd.Equals(IntPtr.Zero))
{
@ -137,7 +110,7 @@ namespace Wox.Helper
if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL)))
{
StringBuilder sb = new StringBuilder(256);
GetClassName(hWnd, sb, sb.Capacity);
_ = NativeMethods.GetClassName(hWnd, sb, sb.Capacity);
string windowClass = sb.ToString();
//for Win+Tab (Flip3D)
@ -147,7 +120,7 @@ namespace Wox.Helper
}
RECT appBounds;
GetWindowRect(hWnd, out appBounds);
_ = NativeMethods.GetWindowRect(hWnd, out appBounds);
//for console (ConsoleWindowClass), we have to check for negative dimensions
if (windowClass == WINDOW_CLASS_CONSOLE)
@ -158,8 +131,8 @@ namespace Wox.Helper
//for desktop (Progman or WorkerW, depends on the system), we have to check
if (windowClass == WINDOW_CLASS_PROGMAN || windowClass == WINDOW_CLASS_WORKERW)
{
IntPtr hWndDesktop = FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null);
hWndDesktop = FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView");
IntPtr hWndDesktop = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null);
hWndDesktop = NativeMethods.FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView");
if (hWndDesktop != null && !hWndDesktop.Equals(IntPtr.Zero))
{
return false;
@ -184,7 +157,7 @@ namespace Wox.Helper
public static void DisableControlBox(Window win)
{
var hwnd = new WindowInteropHelper(win).Handle;
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
_ = NativeMethods.SetWindowLong(hwnd, GWL_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
}
/// <summary>
@ -214,7 +187,7 @@ namespace Wox.Helper
[StructLayout(LayoutKind.Sequential)]
public struct RECT
internal struct RECT
{
public int Left;
public int Top;

View File

@ -1,7 +1,7 @@
<Window x:Class="PowerLauncher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:Wox.ViewModel;assembly=Wox"
xmlns:vm="clr-namespace:PowerLauncher.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PowerLauncher"

View File

@ -3,9 +3,9 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media.Animation;
using Wox.Helper;
using PowerLauncher.Helper;
using Wox.Infrastructure.UserSettings;
using Wox.ViewModel;
using PowerLauncher.ViewModel;
using Screen = System.Windows.Forms.Screen;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
@ -66,11 +66,11 @@ namespace PowerLauncher
private void BringProcessToForeground()
{
// Use SendInput hack to allow Activate to work - required to resolve focus issue https://github.com/microsoft/PowerToys/issues/4270
WindowsInteropHelper.INPUT input = new WindowsInteropHelper.INPUT { type = WindowsInteropHelper.INPUTTYPE.INPUT_MOUSE, data = { } };
WindowsInteropHelper.INPUT input = new WindowsInteropHelper.INPUT { type = WindowsInteropHelper.INPUTTYPE.INPUTMOUSE, data = { } };
WindowsInteropHelper.INPUT[] inputs = new WindowsInteropHelper.INPUT[] { input };
// Send empty mouse event. This makes this thread the last to send input, and hence allows it to pass foreground permission checks
_ = WindowsInteropHelper.SendInput(1, inputs, WindowsInteropHelper.INPUT.Size);
_ = NativeMethods.SendInput(1, inputs, WindowsInteropHelper.INPUT.Size);
Activate();
}

View File

@ -114,17 +114,20 @@
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112.2" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.6" />
<PackageReference Include="System.Data.OleDb" Version="4.7.1" />
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\interop\interop.vcxproj" />
<ProjectReference Include="..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
<ProjectReference Include="..\..\..\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" />
<ProjectReference Include="..\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj" />
<ProjectReference Include="..\Wox.Core\Wox.Core.csproj" />
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj" />
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj" />
<ProjectReference Include="..\Wox\Wox.csproj">
<NoWarn>NU1701</NoWarn>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -6,11 +6,11 @@ using System.Threading.Tasks;
using System.Windows;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Helper;
using PowerLauncher.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Image;
using Wox.Plugin;
using Wox.ViewModel;
using PowerLauncher.ViewModel;
namespace Wox
{
@ -28,10 +28,10 @@ namespace Wox
public PublicAPIInstance(SettingWindowViewModel settingsVM, MainViewModel mainVM, Alphabet alphabet, ThemeManager themeManager)
{
_settingsVM = settingsVM;
_mainVM = mainVM;
_alphabet = alphabet;
_themeManager = themeManager;
_settingsVM = settingsVM ?? throw new ArgumentNullException(nameof(settingsVM));
_mainVM = mainVM ?? throw new ArgumentNullException(nameof(mainVM));
_alphabet = alphabet ?? throw new ArgumentNullException(nameof(alphabet));
_themeManager = themeManager ?? throw new ArgumentNullException(nameof(themeManager));
_themeManager.ThemeChanged += OnThemeChanged;
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
}
@ -45,17 +45,6 @@ namespace Wox
_mainVM.ChangeQueryText(query, requery);
}
public void ChangeQueryText(string query, bool selectAll = false)
{
_mainVM.ChangeQueryText(query, false);
}
[Obsolete]
public void CloseApp()
{
Application.Current.MainWindow.Close();
}
public void RestartApp()
{
_mainVM.MainWindowVisibility = Visibility.Hidden;
@ -88,32 +77,10 @@ namespace Wox
PluginManager.ReloadData();
}
[Obsolete]
public void HideApp()
{
_mainVM.MainWindowVisibility = Visibility.Hidden;
}
[Obsolete]
public void ShowApp()
{
_mainVM.MainWindowVisibility = Visibility.Visible;
}
public void ShowMsg(string title, string subTitle = "", string iconPath = "", bool useMainWindowAsOwner = true)
{
}
public void StartLoadingBar()
{
_mainVM.ProgressBarVisibility = Visibility.Visible;
}
public void StopLoadingBar()
{
_mainVM.ProgressBarVisibility = Visibility.Collapsed;
}
public void InstallPlugin(string path)
{
Application.Current.Dispatcher.Invoke(() => PluginManager.InstallPlugin(path));
@ -129,22 +96,6 @@ namespace Wox
return PluginManager.AllPlugins.ToList();
}
[Obsolete("This will be removed in Wox 1.3")]
public void PushResults(Query query, PluginMetadata plugin, List<Result> results)
{
results.ForEach(o =>
{
o.PluginDirectory = plugin.PluginDirectory;
o.PluginID = plugin.ID;
o.OriginQuery = query;
});
Task.Run(() =>
{
_mainVM.UpdateResultView(results, plugin, query);
});
}
public Theme GetCurrentTheme()
{
return _themeManager.GetCurrentTheme();

View File

@ -1,4 +1,4 @@
<Window x:Class="Wox.ReportWindow"
<Window x:Class="PowerLauncher.ReportWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -6,11 +6,11 @@ using System.Text;
using System.Linq;
using System.Windows;
using System.Windows.Documents;
using Wox.Helper;
using PowerLauncher.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Logger;
namespace Wox
namespace PowerLauncher
{
internal partial class ReportWindow
{
@ -42,7 +42,7 @@ namespace Wox
ErrorTextbox.Document.Blocks.Add(paragraph);
}
private Paragraph Hyperlink(string textBeforeUrl, string url)
private static Paragraph Hyperlink(string textBeforeUrl, string url)
{
var paragraph = new Paragraph();
paragraph.Margin = new Thickness(0);

View File

@ -1,4 +1,4 @@
namespace Wox.Properties {
namespace PowerLauncher.Properties {
// This class allows you to handle specific events on the settings class:

View File

@ -26,7 +26,7 @@ namespace PowerLauncher
{
_settings = settings;
// Set up watcher
_watcher = Helper.GetFileWatcher(PowerLauncherSettings.POWERTOYNAME, "settings.json", OverloadSettings);
_watcher = Microsoft.PowerToys.Settings.UI.Lib.Utilities.Helper.GetFileWatcher(PowerLauncherSettings.POWERTOYNAME, "settings.json", OverloadSettings);
// Load initial settings file
OverloadSettings();

View File

@ -1,6 +1,6 @@
using System;
namespace Wox.Storage
namespace PowerLauncher.Storage
{
public class HistoryItem
{
@ -12,7 +12,7 @@ namespace Wox.Storage
return DateTimeAgo(ExecutedDateTime);
}
private string DateTimeAgo(DateTime dt)
private static string DateTimeAgo(DateTime dt)
{
var span = DateTime.Now - dt;
if (span.Days > 365)

View File

@ -4,11 +4,11 @@ using System.Linq;
using Newtonsoft.Json;
using Wox.Plugin;
namespace Wox.Storage
namespace PowerLauncher.Storage
{
public class History
public class QueryHistory
{
public List<HistoryItem> Items { get; set; } = new List<HistoryItem>();
public List<HistoryItem> Items { get; } = new List<HistoryItem>();
private int _maxHistory = 300;

View File

@ -3,7 +3,7 @@ using System.Linq;
using Newtonsoft.Json;
using Wox.Plugin;
namespace Wox.Storage
namespace PowerLauncher.Storage
{
// todo this class is not thread safe.... but used from multiple threads.
public class TopMostRecord

View File

@ -1,9 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
namespace Wox.Storage
namespace PowerLauncher.Storage
{
public class UserSelectedRecord
{
@ -12,6 +13,11 @@ namespace Wox.Storage
public void Add(Result result)
{
if (result == null)
{
throw new ArgumentNullException(nameof(result));
}
var key = result.ToString();
if (records.TryGetValue(key, out int value))
{
@ -20,13 +26,17 @@ namespace Wox.Storage
else
{
records.Add(key, 1);
}
}
public int GetSelectedCount(Result result)
{
if (records.TryGetValue(result.ToString(), out int value))
if (result == null)
{
throw new ArgumentNullException(nameof(result));
}
if (result != null && records.TryGetValue(result.ToString(), out int value))
{
return value;
}

View File

@ -1,51 +1,51 @@
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;
using Wox.Plugin;
namespace Wox.ViewModel
{
public class ContextMenuItemViewModel : BaseModel
{
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
{
return this._command;
}
set
{
// ICommand does not implement the INotifyPropertyChanged interface and must call OnPropertyChanged() to prevent memory leaks
if (value != this._command)
{
this._command = value;
OnPropertyChanged();
}
}
}
public Key AcceleratorKey { get; set; }
public ModifierKeys AcceleratorModifiers { get; set; }
public bool IsAcceleratorKeyEnabled { get; set; }
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)
{
var eventData = new LauncherResultActionEvent()
{
PluginName = PluginName,
Trigger = triggerType.ToString(),
ActionName = Title
};
PowerToysTelemetry.Log.WriteEvent(eventData);
}
}
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;
using Wox.Plugin;
namespace PowerLauncher.ViewModel
{
public class ContextMenuItemViewModel : BaseModel
{
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
{
return this._command;
}
set
{
// ICommand does not implement the INotifyPropertyChanged interface and must call OnPropertyChanged() to prevent memory leaks
if (value != this._command)
{
this._command = value;
OnPropertyChanged();
}
}
}
public Key AcceleratorKey { get; set; }
public ModifierKeys AcceleratorModifiers { get; set; }
public bool IsAcceleratorKeyEnabled { get; set; }
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)
{
var eventData = new LauncherResultActionEvent()
{
PluginName = PluginName,
Trigger = triggerType.ToString(),
ActionName = Title
};
PowerToysTelemetry.Log.WriteEvent(eventData);
}
}
}

View File

@ -9,41 +9,41 @@ using System.Windows.Input;
using System.Windows.Media;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Helper;
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 Wox.Storage;
using PowerLauncher.Storage;
using Microsoft.PowerToys.Telemetry;
using interop;
using System.Globalization;
namespace Wox.ViewModel
namespace PowerLauncher.ViewModel
{
public class MainViewModel : BaseModel, ISavable, IDisposable
{
#region Private Fields
private bool _isQueryRunning;
private Query _lastQuery;
private static Query _emptyQuery = new Query();
private static bool _disposed;
private string _queryTextBeforeLeaveResults;
private readonly WoxJsonStorage<History> _historyItemsStorage;
private readonly WoxJsonStorage<QueryHistory> _historyItemsStorage;
private readonly WoxJsonStorage<UserSelectedRecord> _userSelectedRecordStorage;
private readonly WoxJsonStorage<TopMostRecord> _topMostRecordStorage;
private readonly Settings _settings;
private readonly History _history;
private readonly QueryHistory _history;
private readonly UserSelectedRecord _userSelectedRecord;
private readonly TopMostRecord _topMostRecord;
private CancellationTokenSource _updateSource;
private CancellationTokenSource _updateSource { get; set; }
private CancellationToken _updateToken;
private bool _saved;
private HotkeyManager _hotkeyManager;
private HotkeyManager _hotkeyManager { get; set; }
private ushort _hotkeyHandle;
private readonly Internationalization _translator = InternationalizationManager.Instance;
@ -59,9 +59,9 @@ namespace Wox.ViewModel
_lastQuery = _emptyQuery;
_disposed = false;
_settings = settings;
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_historyItemsStorage = new WoxJsonStorage<History>();
_historyItemsStorage = new WoxJsonStorage<QueryHistory>();
_userSelectedRecordStorage = new WoxJsonStorage<UserSelectedRecord>();
_topMostRecordStorage = new WoxJsonStorage<TopMostRecord>();
_history = _historyItemsStorage.Load();
@ -82,12 +82,12 @@ namespace Wox.ViewModel
{
Application.Current.Dispatcher.Invoke(() =>
{
if (_settings.PreviousHotkey != "")
if (!string.IsNullOrEmpty(_settings.PreviousHotkey))
{
_hotkeyManager.UnregisterHotkey(_hotkeyHandle);
}
if (_settings.Hotkey != "")
if (!string.IsNullOrEmpty(_settings.Hotkey))
{
SetHotkey(_settings.Hotkey, OnHotkey);
}
@ -174,7 +174,7 @@ namespace Wox.ViewModel
if (index != null)
{
results.SelectedIndex = int.Parse(index.ToString());
results.SelectedIndex = int.Parse(index.ToString(), CultureInfo.InvariantCulture);
}
if(results.SelectedItem != null)
@ -373,7 +373,9 @@ namespace Wox.ViewModel
private void QueryHistory()
{
const string id = "Query History ID";
var query = QueryText.ToLower().Trim();
#pragma warning disable CA1308 // Normalize strings to uppercase
var query = QueryText.ToLower(CultureInfo.InvariantCulture).Trim();
#pragma warning restore CA1308 // Normalize strings to uppercase
History.Clear();
var results = new List<Result>();
@ -383,8 +385,8 @@ namespace Wox.ViewModel
var time = _translator.GetTranslation("lastExecuteTime");
var result = new Result
{
Title = string.Format(title, h.Query),
SubTitle = string.Format(time, h.ExecutedDateTime),
Title = string.Format(CultureInfo.InvariantCulture, title, h.Query),
SubTitle = string.Format(CultureInfo.InvariantCulture, time, h.ExecutedDateTime),
IcoPath = "Images\\history.png",
OriginQuery = new Query { RawQuery = h.Query },
Action = _ =>
@ -425,7 +427,6 @@ namespace Wox.ViewModel
_updateToken = currentCancellationToken;
ProgressBarVisibility = Visibility.Hidden;
_isQueryRunning = true;
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
if (query != null)
{
@ -468,7 +469,6 @@ namespace Wox.ViewModel
// this should happen once after all queries are done so progress bar should continue
// until the end of all querying
_isQueryRunning = false;
if (currentUpdateSource == _updateSource)
{ // update to hidden if this is still the current query
ProgressBarVisibility = Visibility.Hidden;
@ -561,10 +561,11 @@ namespace Wox.ViewModel
_hotkeyHandle = _hotkeyManager.RegisterHotkey(hotkey, action);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception)
#pragma warning restore CA1031 // Do not catch general exception types
{
string errorMsg =
string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
string errorMsg = string.Format(CultureInfo.InvariantCulture, InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
MessageBox.Show(errorMsg);
}
}
@ -659,6 +660,21 @@ namespace Wox.ViewModel
/// </summary>
public void UpdateResultView(List<Result> list, PluginMetadata metadata, Query originQuery)
{
if(list == null)
{
throw new ArgumentNullException(nameof(list));
}
if (metadata == null)
{
throw new ArgumentNullException(nameof(metadata));
}
if (originQuery == null)
{
throw new ArgumentNullException(nameof(originQuery));
}
foreach (var result in list)
{
if (_topMostRecord.IsTopMost(result))
@ -769,6 +785,7 @@ namespace Wox.ViewModel
_hotkeyManager.UnregisterHotkey(_hotkeyHandle);
}
_hotkeyManager.Dispose();
_updateSource.Dispose();
_disposed = true;
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.Windows.Input;
namespace Wox.ViewModel
namespace PowerLauncher.ViewModel
{
public class RelayCommand : ICommand
{
@ -17,7 +17,11 @@ namespace Wox.ViewModel
return true;
}
public event EventHandler CanExecuteChanged;
public event EventHandler CanExecuteChanged
{
add { }
remove { }
}
public virtual void Execute(object parameter)
{

View File

@ -1,273 +1,271 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using System.Windows.Controls.Ribbon;
using System.Windows.Input;
using System.Windows.Media;
using Wox.Core.Plugin;
using Wox.Infrastructure;
using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Wox.Helper;
namespace Wox.ViewModel
{
public class ResultViewModel : BaseModel
{
public enum ActivationType
{
Selection,
Hover
};
public ObservableCollection<ContextMenuItemViewModel> ContextMenuItems { get; set; } = new ObservableCollection<ContextMenuItemViewModel>();
public ICommand ActivateContextButtonsHoverCommand { get; set; }
public ICommand ActivateContextButtonsSelectionCommand { get; set; }
public ICommand DeactivateContextButtonsHoverCommand { get; set; }
public ICommand DeactivateContextButtonsSelectionCommand { get; set; }
public bool IsSelected { get; set; }
public bool IsHovered { get; set; }
public bool AreContextButtonsActive { get; set; }
public int ContextMenuSelectedIndex { get; set; }
const int NoSelectionIndex = -1;
public ResultViewModel(Result result)
{
if (result != null)
{
Result = result;
}
ContextMenuSelectedIndex = NoSelectionIndex;
LoadContextMenu();
ActivateContextButtonsHoverCommand = new RelayCommand(ActivateContextButtonsHoverAction);
ActivateContextButtonsSelectionCommand = new RelayCommand(ActivateContextButtonsSelectionAction);
DeactivateContextButtonsHoverCommand = new RelayCommand(DeactivateContextButtonsHoverAction);
DeactivateContextButtonsSelectionCommand = new RelayCommand(DeactivateContextButtonsSelectionAction);
}
private void ActivateContextButtonsHoverAction(object sender)
{
ActivateContextButtons(ActivationType.Hover);
}
private void ActivateContextButtonsSelectionAction(object sender)
{
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.
if (ContextMenuItems.Count > 0)
{
AreContextButtonsActive = true;
}
else
{
AreContextButtonsActive = false;
}
if (activationType == ActivationType.Selection)
{
IsSelected = true;
EnableContextMenuAcceleratorKeys();
}
else if (activationType == ActivationType.Hover)
{
IsHovered = true;
}
}
private void DeactivateContextButtonsHoverAction(object sender)
{
DeactivateContextButtons(ActivationType.Hover);
}
private void DeactivateContextButtonsSelectionAction(object sender)
{
DeactivateContextButtons(ActivationType.Selection);
}
public void DeactivateContextButtons(ActivationType activationType)
{
if (activationType == ActivationType.Selection)
{
IsSelected = false;
DisableContextMenuAcceleratorkeys();
}
else if (activationType == ActivationType.Hover)
{
IsHovered = false;
}
// Result does not contain any context menu items - we don't need to show the context menu ListView at all.
if (ContextMenuItems?.Count > 0)
{
AreContextButtonsActive = IsSelected || IsHovered;
}
else
{
AreContextButtonsActive = false;
}
}
public void LoadContextMenu()
{
var results = PluginManager.GetContextMenusForPlugin(Result);
ContextMenuItems.Clear();
foreach (var r in results)
{
ContextMenuItems.Add(new ContextMenuItemViewModel()
{
PluginName = r.PluginName,
Title = r.Title,
Glyph = r.Glyph,
FontFamily = r.FontFamily,
AcceleratorKey = r.AcceleratorKey,
AcceleratorModifiers = r.AcceleratorModifiers,
Command = new RelayCommand(_ =>
{
bool hideWindow = r.Action != null && r.Action(new ActionContext
{
SpecialKeyState = KeyboardHelper.CheckModifiers()
});
if (hideWindow)
{
//TODO - Do we hide the window
// MainWindowVisibility = Visibility.Collapsed;
}
})
});
}
}
private void EnableContextMenuAcceleratorKeys()
{
foreach (var i in ContextMenuItems)
{
i.IsAcceleratorKeyEnabled = true;
}
}
private void DisableContextMenuAcceleratorkeys()
{
foreach (var i in ContextMenuItems)
{
i.IsAcceleratorKeyEnabled = false;
}
}
public ImageSource Image
{
get
{
var imagePath = Result.IcoPath;
if (string.IsNullOrEmpty(imagePath) && Result.Icon != null)
{
try
{
return Result.Icon();
}
catch (Exception e)
{
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
imagePath = ImageLoader.ErrorIconPath;
}
}
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
return ImageLoader.Load(imagePath);
}
}
//Returns false if we've already reached the last item.
public bool SelectNextContextButton()
{
if (ContextMenuSelectedIndex == (ContextMenuItems.Count - 1))
{
ContextMenuSelectedIndex = NoSelectionIndex;
return false;
}
ContextMenuSelectedIndex++;
return true;
}
//Returns false if we've already reached the first item.
public bool SelectPrevContextButton()
{
if (ContextMenuSelectedIndex == NoSelectionIndex)
{
return false;
}
ContextMenuSelectedIndex--;
return true;
}
public void SelectLastContextButton()
{
ContextMenuSelectedIndex = ContextMenuItems.Count - 1;
}
public bool HasSelectedContextButton()
{
var isContextSelected = (ContextMenuSelectedIndex != NoSelectionIndex);
return isContextSelected;
}
/// <summary>
/// Triggers the action on the selected context button
/// </summary>
/// <returns>False if there is nothing selected, otherwise true</returns>
public bool ExecuteSelectedContextButton()
{
if (HasSelectedContextButton())
{
ContextMenuItems[ContextMenuSelectedIndex].Command.Execute(null);
return true;
}
return false;
}
public Result Result { get; }
public override bool Equals(object obj)
{
var r = obj as ResultViewModel;
if (r != null)
{
return Result.Equals(r.Result);
}
else
{
return false;
}
}
public override int GetHashCode()
{
return Result.GetHashCode();
}
public override string ToString()
{
var display = String.IsNullOrEmpty(Result.QueryTextDisplay) ? Result.Title : Result.QueryTextDisplay;
return display;
}
}
}
using System;
using System.Collections.ObjectModel;
using System.Windows.Input;
using System.Windows.Media;
using Wox.Core.Plugin;
using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using PowerLauncher.Helper;
namespace PowerLauncher.ViewModel
{
public class ResultViewModel : BaseModel
{
public enum ActivationType
{
Selection,
Hover
};
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; }
public bool IsSelected { get; set; }
public bool IsHovered { get; set; }
public bool AreContextButtonsActive { get; set; }
public int ContextMenuSelectedIndex { get; set; }
const int NoSelectionIndex = -1;
public ResultViewModel(Result result)
{
if (result != null)
{
Result = result;
}
ContextMenuSelectedIndex = NoSelectionIndex;
LoadContextMenu();
ActivateContextButtonsHoverCommand = new RelayCommand(ActivateContextButtonsHoverAction);
ActivateContextButtonsSelectionCommand = new RelayCommand(ActivateContextButtonsSelectionAction);
DeactivateContextButtonsHoverCommand = new RelayCommand(DeactivateContextButtonsHoverAction);
DeactivateContextButtonsSelectionCommand = new RelayCommand(DeactivateContextButtonsSelectionAction);
}
private void ActivateContextButtonsHoverAction(object sender)
{
ActivateContextButtons(ActivationType.Hover);
}
private void ActivateContextButtonsSelectionAction(object sender)
{
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.
if (ContextMenuItems.Count > 0)
{
AreContextButtonsActive = true;
}
else
{
AreContextButtonsActive = false;
}
if (activationType == ActivationType.Selection)
{
IsSelected = true;
EnableContextMenuAcceleratorKeys();
}
else if (activationType == ActivationType.Hover)
{
IsHovered = true;
}
}
private void DeactivateContextButtonsHoverAction(object sender)
{
DeactivateContextButtons(ActivationType.Hover);
}
private void DeactivateContextButtonsSelectionAction(object sender)
{
DeactivateContextButtons(ActivationType.Selection);
}
public void DeactivateContextButtons(ActivationType activationType)
{
if (activationType == ActivationType.Selection)
{
IsSelected = false;
DisableContextMenuAcceleratorkeys();
}
else if (activationType == ActivationType.Hover)
{
IsHovered = false;
}
// Result does not contain any context menu items - we don't need to show the context menu ListView at all.
if (ContextMenuItems?.Count > 0)
{
AreContextButtonsActive = IsSelected || IsHovered;
}
else
{
AreContextButtonsActive = false;
}
}
public void LoadContextMenu()
{
var results = PluginManager.GetContextMenusForPlugin(Result);
ContextMenuItems.Clear();
foreach (var r in results)
{
ContextMenuItems.Add(new ContextMenuItemViewModel()
{
PluginName = r.PluginName,
Title = r.Title,
Glyph = r.Glyph,
FontFamily = r.FontFamily,
AcceleratorKey = r.AcceleratorKey,
AcceleratorModifiers = r.AcceleratorModifiers,
Command = new RelayCommand(_ =>
{
bool hideWindow = r.Action != null && r.Action(new ActionContext
{
SpecialKeyState = KeyboardHelper.CheckModifiers()
});
if (hideWindow)
{
//TODO - Do we hide the window
// MainWindowVisibility = Visibility.Collapsed;
}
})
});
}
}
private void EnableContextMenuAcceleratorKeys()
{
foreach (var i in ContextMenuItems)
{
i.IsAcceleratorKeyEnabled = true;
}
}
private void DisableContextMenuAcceleratorkeys()
{
foreach (var i in ContextMenuItems)
{
i.IsAcceleratorKeyEnabled = false;
}
}
public ImageSource Image
{
get
{
var imagePath = Result.IcoPath;
if (string.IsNullOrEmpty(imagePath) && Result.Icon != null)
{
try
{
return Result.Icon();
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
{
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
imagePath = ImageLoader.ErrorIconPath;
}
}
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
return ImageLoader.Load(imagePath);
}
}
//Returns false if we've already reached the last item.
public bool SelectNextContextButton()
{
if (ContextMenuSelectedIndex == (ContextMenuItems.Count - 1))
{
ContextMenuSelectedIndex = NoSelectionIndex;
return false;
}
ContextMenuSelectedIndex++;
return true;
}
//Returns false if we've already reached the first item.
public bool SelectPrevContextButton()
{
if (ContextMenuSelectedIndex == NoSelectionIndex)
{
return false;
}
ContextMenuSelectedIndex--;
return true;
}
public void SelectLastContextButton()
{
ContextMenuSelectedIndex = ContextMenuItems.Count - 1;
}
public bool HasSelectedContextButton()
{
var isContextSelected = (ContextMenuSelectedIndex != NoSelectionIndex);
return isContextSelected;
}
/// <summary>
/// Triggers the action on the selected context button
/// </summary>
/// <returns>False if there is nothing selected, otherwise true</returns>
public bool ExecuteSelectedContextButton()
{
if (HasSelectedContextButton())
{
ContextMenuItems[ContextMenuSelectedIndex].Command.Execute(null);
return true;
}
return false;
}
public Result Result { get; }
public override bool Equals(object obj)
{
var r = obj as ResultViewModel;
if (r != null)
{
return Result.Equals(r.Result);
}
else
{
return false;
}
}
public override int GetHashCode()
{
return Result.GetHashCode();
}
public override string ToString()
{
var display = String.IsNullOrEmpty(Result.QueryTextDisplay) ? Result.Title : Result.QueryTextDisplay;
return display;
}
}
}

View File

@ -1,16 +1,15 @@
using System;
using PowerLauncher.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
namespace Wox.ViewModel
namespace PowerLauncher.ViewModel
{
public class ResultsViewModel : BaseModel
{
@ -30,13 +29,13 @@ namespace Wox.ViewModel
}
public ResultsViewModel(Settings settings) : this()
{
_settings = settings;
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_settings.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(_settings.MaxResultsToShow))
{
Application.Current.Dispatcher.Invoke(() =>
{
Application.Current.Dispatcher.Invoke(() =>
{
OnPropertyChanged(nameof(MaxHeight));
});
}
@ -48,11 +47,11 @@ namespace Wox.ViewModel
#region Properties
public int MaxHeight
{
get
{
get
{
return _settings.MaxResultsToShow * 75;
}
return _settings.MaxResultsToShow * 75;
}
}
public int SelectedIndex { get; set; }
@ -89,7 +88,7 @@ namespace Wox.ViewModel
#region Private Methods
private int InsertIndexOf(int newScore, IList<ResultViewModel> list)
private static int InsertIndexOf(int newScore, IList<ResultViewModel> list)
{
int index = 0;
for (; index < list.Count; index++)
@ -265,12 +264,15 @@ namespace Wox.ViewModel
public static void SetFormattedText(DependencyObject textBlock, IList<int> value)
{
textBlock.SetValue(FormattedTextProperty, value);
if (textBlock != null)
{
textBlock.SetValue(FormattedTextProperty, value);
}
}
public static Inline GetFormattedText(DependencyObject textBlock)
{
return (Inline)textBlock.GetValue(FormattedTextProperty);
return (Inline)textBlock?.GetValue(FormattedTextProperty);
}
private static void FormattedTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@ -287,62 +289,6 @@ namespace Wox.ViewModel
}
#endregion
public class ResultCollection : ObservableCollection<ResultViewModel>
{
public void RemoveAll(Predicate<ResultViewModel> predicate)
{
CheckReentrancy();
for (int i = Count - 1; i >= 0; i--)
{
if (predicate(this[i]))
{
RemoveAt(i);
}
}
}
/// <summary>
/// Update the results collection with new results, try to keep identical results
/// </summary>
/// <param name="newItems"></param>
public void Update(List<ResultViewModel> newItems)
{
int newCount = newItems.Count;
int oldCount = Items.Count;
int location = newCount > oldCount ? oldCount : newCount;
for (int i = 0; i < location; i++)
{
ResultViewModel oldResult = this[i];
ResultViewModel newResult = newItems[i];
if (!oldResult.Equals(newResult))
{ // result is not the same update it in the current index
this[i] = newResult;
}
else if (oldResult.Result.Score != newResult.Result.Score)
{
this[i].Result.Score = newResult.Result.Score;
}
}
if (newCount >= oldCount)
{
for (int i = oldCount; i < newCount; i++)
{
Add(newItems[i]);
}
}
else
{
for (int i = oldCount - 1; i >= newCount; i--)
{
RemoveAt(i);
}
}
}
}
}
}

View File

@ -1,9 +1,10 @@
using System.Globalization;
using Wox.Core.Resource;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
namespace Wox.ViewModel
namespace PowerLauncher.ViewModel
{
public class SettingWindowViewModel : BaseModel
{
@ -31,13 +32,13 @@ namespace Wox.ViewModel
#region general
private Internationalization _translater => InternationalizationManager.Instance;
private static Internationalization _translater => InternationalizationManager.Instance;
#endregion
#region about
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
public string ActivatedTimes => string.Format(CultureInfo.InvariantCulture, _translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
#endregion
}

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
namespace Wox.Plugin
{
@ -8,15 +7,6 @@ namespace Wox.Plugin
/// </summary>
public interface IPublicAPI
{
/// <summary>
/// Push result to query box
/// </summary>
/// <param name="query"></param>
/// <param name="plugin"></param>
/// <param name="results"></param>
[Obsolete("This method will be removed in Wox 1.3")]
void PushResults(Query query, PluginMetadata plugin, List<Result> results);
/// <summary>
/// Change Wox query
/// </summary>
@ -27,36 +17,11 @@ namespace Wox.Plugin
/// </param>
void ChangeQuery(string query, bool requery = false);
/// <summary>
/// Just change the query text, this won't raise search
/// </summary>
/// <param name="query"></param>
[Obsolete]
void ChangeQueryText(string query, bool selectAll = false);
/// <summary>
/// Close Wox
/// </summary>
[Obsolete]
void CloseApp();
/// <summary>
/// Restart Wox
/// </summary>
void RestartApp();
/// <summary>
/// Hide Wox
/// </summary>
[Obsolete]
void HideApp();
/// <summary>
/// Show Wox
/// </summary>
[Obsolete]
void ShowApp();
/// <summary>
/// Get current theme
/// </summary>
@ -93,18 +58,6 @@ namespace Wox.Plugin
/// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
void ShowMsg(string title, string subTitle = "", string iconPath = "", bool useMainWindowAsOwner = true);
/// <summary>
/// Show loading animation
/// </summary>
[Obsolete("automatically start")]
void StartLoadingBar();
/// <summary>
/// Stop loading animation
/// </summary>
[Obsolete("automatically stop")]
void StopLoadingBar();
/// <summary>
/// Install Wox plugin
/// </summary>

View File

@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using Wox.Plugin;
using Wox.ViewModel;
using PowerLauncher.ViewModel;
namespace Wox.Test
{

View File

@ -42,10 +42,10 @@
<ProjectReference Include="..\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.csproj" />
<ProjectReference Include="..\Plugins\Microsoft.Plugin.Indexer\Microsoft.Plugin.Indexer.csproj" />
<ProjectReference Include="..\Plugins\Microsoft.Plugin.Program\Microsoft.Plugin.Program.csproj" />
<ProjectReference Include="..\PowerLauncher\PowerLauncher.csproj" />
<ProjectReference Include="..\Wox.Core\Wox.Core.csproj" />
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj" />
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj" />
<ProjectReference Include="..\Wox\Wox.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
using System.Windows.Input;
using NUnit.Framework;
using Wox.Plugin;
using Wox.ViewModel;
using PowerLauncher.ViewModel;
using System.Runtime.CompilerServices;
namespace Wox.Test

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressWarnings" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -1,7 +0,0 @@
using System.Reflection;
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]

View File

@ -1,74 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Wox.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Wox.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon placeholderLauncher
{
get {
object obj = ResourceManager.GetObject("placeholderLauncher", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="placeholderLauncher" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\placeholderLauncher.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Wox.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Microsoft/PowerToys")]
public string GithubRepo {
get {
return ((string)(this["GithubRepo"]));
}
}
}
}

View File

@ -1,9 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Launcher.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://github.com/Microsoft/PowerToys</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,71 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<StartupObject></StartupObject>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>..\..\..\..\x64\Debug\modules\launcher\Wox</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\..\..\..\x64\Release\modules\launcher\Wox</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Fody" Version="6.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="InputSimulator" Version="1.0.4" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="Mages" Version="1.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NuGet.CommandLine" Version="5.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Data.OleDb" Version="4.7.1" />
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
<PackageReference Include="System.Data.SQLite" Version="1.0.112.2" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112.2" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\interop\interop.vcxproj" />
<ProjectReference Include="..\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj" />
<ProjectReference Include="..\Wox.Core\Wox.Core.csproj" />
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj" />
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj" />
</ItemGroup>
</Project>