mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add query history plugin & upgrade all third-party packages
This commit is contained in:
parent
9d39b616f9
commit
b49209a0d9
34 changed files with 445 additions and 51 deletions
|
|
@ -40,7 +40,7 @@
|
|||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="WindowsInput" version="0.2.0.0" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -31,7 +31,7 @@ namespace Wox.Plugin.Folder
|
|||
}
|
||||
}
|
||||
|
||||
private void ApiBackKeyDownEvent(object sender, WoxKeyDownEventArgs e)
|
||||
private void ApiBackKeyDownEvent(WoxKeyDownEventArgs e)
|
||||
{
|
||||
string query = e.Query;
|
||||
if (Directory.Exists(query))
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -39,9 +39,9 @@
|
|||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
53
Plugins/Wox.Plugin.QueryHistory/HistoryItem.cs
Normal file
53
Plugins/Wox.Plugin.QueryHistory/HistoryItem.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin.QueryHistory
|
||||
{
|
||||
public class HistoryItem
|
||||
{
|
||||
public string Query { get; set; }
|
||||
public DateTime ExecutedDateTime { get; set; }
|
||||
|
||||
public string GetTimeAgo()
|
||||
{
|
||||
return DateTimeAgo(ExecutedDateTime);
|
||||
}
|
||||
|
||||
private string DateTimeAgo(DateTime dt)
|
||||
{
|
||||
TimeSpan span = DateTime.Now - dt;
|
||||
if (span.Days > 365)
|
||||
{
|
||||
int years = (span.Days / 365);
|
||||
if (span.Days % 365 != 0)
|
||||
years += 1;
|
||||
return String.Format("about {0} {1} ago",
|
||||
years, years == 1 ? "year" : "years");
|
||||
}
|
||||
if (span.Days > 30)
|
||||
{
|
||||
int months = (span.Days / 30);
|
||||
if (span.Days % 31 != 0)
|
||||
months += 1;
|
||||
return String.Format("about {0} {1} ago",
|
||||
months, months == 1 ? "month" : "months");
|
||||
}
|
||||
if (span.Days > 0)
|
||||
return String.Format("about {0} {1} ago",
|
||||
span.Days, span.Days == 1 ? "day" : "days");
|
||||
if (span.Hours > 0)
|
||||
return String.Format("about {0} {1} ago",
|
||||
span.Hours, span.Hours == 1 ? "hour" : "hours");
|
||||
if (span.Minutes > 0)
|
||||
return String.Format("about {0} {1} ago",
|
||||
span.Minutes, span.Minutes == 1 ? "minute" : "minutes");
|
||||
if (span.Seconds > 5)
|
||||
return String.Format("about {0} seconds ago", span.Seconds);
|
||||
if (span.Seconds <= 5)
|
||||
return "just now";
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Plugins/Wox.Plugin.QueryHistory/Images/history.png
Normal file
BIN
Plugins/Wox.Plugin.QueryHistory/Images/history.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
36
Plugins/Wox.Plugin.QueryHistory/Properties/AssemblyInfo.cs
Normal file
36
Plugins/Wox.Plugin.QueryHistory/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Wox.Plugin.QueryHistory")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Wox.Plugin.QueryHistory")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("25ab1bbc-f625-4bf5-a2d0-73313abdaae5")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
51
Plugins/Wox.Plugin.QueryHistory/QueryHistory.cs
Normal file
51
Plugins/Wox.Plugin.QueryHistory/QueryHistory.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Wox.Plugin.QueryHistory
|
||||
{
|
||||
public class QueryHistory : IPlugin
|
||||
{
|
||||
private PluginInitContext context;
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
var histories = QueryHistoryStorage.Instance.GetHistory();
|
||||
string filter = query.GetAllRemainingParameter();
|
||||
if (!string.IsNullOrEmpty(filter))
|
||||
{
|
||||
histories = histories.Where(o => o.Query.Contains(filter)).ToList();
|
||||
}
|
||||
return histories.Select(history => new Result()
|
||||
{
|
||||
Title = history.Query,
|
||||
SubTitle = history.GetTimeAgo(),
|
||||
IcoPath = "Images\\history.png",
|
||||
Action = _ =>
|
||||
{
|
||||
context.API.ChangeQuery(history.Query);
|
||||
return false;
|
||||
}
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
context.API.AfterWoxQueryEvent += API_AfterWoxQueryEvent;
|
||||
context.API.BeforeWoxQueryEvent += API_BeforeWoxQueryEvent;
|
||||
}
|
||||
|
||||
void API_BeforeWoxQueryEvent(WoxQueryEventArgs e)
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
private void API_AfterWoxQueryEvent(WoxQueryEventArgs e)
|
||||
{
|
||||
QueryHistoryStorage.Instance.Add(e.Query.RawQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Plugins/Wox.Plugin.QueryHistory/QueryHistoryStorage.cs
Normal file
83
Plugins/Wox.Plugin.QueryHistory/QueryHistoryStorage.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Core.Exception;
|
||||
using Wox.Infrastructure.Storage;
|
||||
|
||||
namespace Wox.Plugin.QueryHistory
|
||||
{
|
||||
public class QueryHistoryStorage : JsonStrorage<QueryHistoryStorage>
|
||||
{
|
||||
[JsonProperty]
|
||||
private List<HistoryItem> History = new List<HistoryItem>();
|
||||
|
||||
private int MaxHistory = 300;
|
||||
private int cursor = 0;
|
||||
|
||||
protected override string ConfigFolder
|
||||
{
|
||||
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
||||
}
|
||||
|
||||
protected override string ConfigName
|
||||
{
|
||||
get { return "QueryHistory"; }
|
||||
}
|
||||
|
||||
public HistoryItem Pop()
|
||||
{
|
||||
if (History.Count == 0) return null;
|
||||
|
||||
if (cursor > History.Count - 1)
|
||||
{
|
||||
cursor = History.Count - 1;
|
||||
}
|
||||
if (cursor < 0)
|
||||
{
|
||||
cursor = 0;
|
||||
}
|
||||
|
||||
return History[cursor--];
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
cursor = History.Count - 1;
|
||||
}
|
||||
|
||||
public void Add(string query)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query)) return;
|
||||
if (History.Count > MaxHistory)
|
||||
{
|
||||
History.RemoveAt(0);
|
||||
}
|
||||
|
||||
if (History.Count > 0 && History.Last().Query == query)
|
||||
{
|
||||
History.Last().ExecutedDateTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
History.Add(new HistoryItem()
|
||||
{
|
||||
Query = query,
|
||||
ExecutedDateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
|
||||
if (History.Count % 5 == 0)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
public List<HistoryItem> GetHistory()
|
||||
{
|
||||
return History.OrderByDescending(o => o.ExecutedDateTime).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Wox.Plugin.QueryHistory</RootNamespace>
|
||||
<AssemblyName>Wox.Plugin.QueryHistory</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.QueryHistory\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Program\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HistoryItem.cs" />
|
||||
<Compile Include="QueryHistory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="QueryHistoryStorage.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
||||
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
||||
<Name>Wox.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||
<Name>Wox.Infrastructure</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||
<Name>Wox.Plugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\history.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
4
Plugins/Wox.Plugin.QueryHistory/packages.config
Normal file
4
Plugins/Wox.Plugin.QueryHistory/packages.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
12
Plugins/Wox.Plugin.QueryHistory/plugin.json
Normal file
12
Plugins/Wox.Plugin.QueryHistory/plugin.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"ID":"54F327C503414B9489CDD331EE9472EF",
|
||||
"ActionKeyword":"history",
|
||||
"Name":"Query History",
|
||||
"Description":"Remember Wox query history",
|
||||
"Author":"qianlifeng",
|
||||
"Version":"1.0.0",
|
||||
"Language":"csharp",
|
||||
"Website":"http://www.getwox.com/plugin",
|
||||
"ExecuteFileName":"Wox.Plugin.QueryHistory.dll",
|
||||
"IcoPath":"Images\\history.png"
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ namespace Wox.Plugin.WebSearch
|
|||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
},true);
|
||||
|
||||
if (UserSettingStorage.Instance.EnableWebSearchSuggestion && !string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -16,15 +16,6 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||
public void Dispatch(Query query)
|
||||
{
|
||||
var queryPlugins = allSytemPlugins;
|
||||
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == query.ActionName && o.Enabled))
|
||||
{
|
||||
//websearch mode
|
||||
queryPlugins = new List<PluginPair>()
|
||||
{
|
||||
allSytemPlugins.First(o => o.Metadata.ID == "565B73353DBF4806919830B9202EE3BF")
|
||||
};
|
||||
}
|
||||
|
||||
foreach (PluginPair pair in queryPlugins)
|
||||
{
|
||||
PluginPair pair1 = pair;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,14 @@ namespace Wox.Core.UserSettings
|
|||
OpacityMode = OpacityMode.Normal;
|
||||
LeaveCmdOpen = false;
|
||||
HideWhenDeactive = false;
|
||||
|
||||
CustomPluginHotkeys = new List<CustomPluginHotkey>()
|
||||
{
|
||||
new CustomPluginHotkey()
|
||||
{
|
||||
ActionKeyword = "history ",
|
||||
Hotkey = "Alt + H"
|
||||
}
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -6,7 +6,8 @@ using System.Windows.Input;
|
|||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public delegate void WoxKeyDownEventHandler(object sender, WoxKeyDownEventArgs e);
|
||||
public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e);
|
||||
public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Global keyboard events
|
||||
|
|
@ -22,4 +23,9 @@ namespace Wox.Plugin
|
|||
public string Query { get; set; }
|
||||
public KeyEventArgs keyEventArgs { get; set; }
|
||||
}
|
||||
|
||||
public class WoxQueryEventArgs
|
||||
{
|
||||
public Query Query { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ namespace Wox.Plugin
|
|||
/// <param name="query"></param>
|
||||
/// <param name="plugin"></param>
|
||||
/// <param name="results"></param>
|
||||
void PushResults(Query query,PluginMetadata plugin, List<Result> results);
|
||||
/// <param name="clearBeforeInsert"></param>
|
||||
void PushResults(Query query,PluginMetadata plugin, List<Result> results,bool clearBeforeInsert = false);
|
||||
|
||||
bool ShellRun(string cmd, bool runAsAdministrator = false);
|
||||
|
||||
|
|
@ -43,5 +44,15 @@ namespace Wox.Plugin
|
|||
event WoxKeyDownEventHandler BackKeyDownEvent;
|
||||
|
||||
event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||
|
||||
/// <summary>
|
||||
/// fired after wox execute a query
|
||||
/// </summary>
|
||||
event AfterWoxQueryEventHandler AfterWoxQueryEvent;
|
||||
|
||||
/// <summary>
|
||||
/// fired before wox start to execute a query
|
||||
/// </summary>
|
||||
event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
<HintPath>..\packages\Moq.4.2.1409.1722\lib\net35\Moq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Moq" version="4.2.1409.1722" targetFramework="net35" />
|
||||
<package id="NUnit" version="2.6.3" targetFramework="net35" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net35" />
|
||||
</packages>
|
||||
7
Wox.sln
7
Wox.sln
|
|
@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Color", "Plugins
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.CrashReporter", "Wox.CrashReporter\Wox.CrashReporter.csproj", "{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.QueryHistory", "Plugins\Wox.Plugin.QueryHistory\Wox.Plugin.QueryHistory.csproj", "{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -113,6 +115,10 @@ Global
|
|||
{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -129,5 +135,6 @@ Global
|
|||
{0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{A3DCCBCA-ACC1-421D-B16E-210896234C26} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{F35190AA-4758-4D9E-A193-E3BDF6AD3567} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{B552DCB6-692E-4B1D-9E0B-9096A2A7E6B0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -132,8 +132,10 @@ namespace Wox
|
|||
|
||||
public event WoxKeyDownEventHandler BackKeyDownEvent;
|
||||
public event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||
public event AfterWoxQueryEventHandler AfterWoxQueryEvent;
|
||||
public event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
||||
|
||||
public void PushResults(Query query, PluginMetadata plugin, List<Result> results)
|
||||
public void PushResults(Query query, PluginMetadata plugin, List<Result> results, bool clearBeforeInsert = false)
|
||||
{
|
||||
results.ForEach(o =>
|
||||
{
|
||||
|
|
@ -147,7 +149,7 @@ namespace Wox
|
|||
}
|
||||
o.OriginQuery = query;
|
||||
});
|
||||
OnUpdateResultView(results);
|
||||
OnUpdateResultView(results, clearBeforeInsert);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -360,6 +362,7 @@ namespace Wox
|
|||
}, TimeSpan.FromMilliseconds(100), null);
|
||||
queryHasReturn = false;
|
||||
var q = new Query(lastQuery);
|
||||
FireBeforeWoxQueryEvent(q);
|
||||
Query(q);
|
||||
BackToResultMode();
|
||||
Dispatcher.DelayInvoke("ShowProgressbar", originQuery =>
|
||||
|
|
@ -369,9 +372,42 @@ namespace Wox
|
|||
StartProgress();
|
||||
}
|
||||
}, TimeSpan.FromMilliseconds(150), lastQuery);
|
||||
FireAfterWoxQueryEvent(q);
|
||||
}, TimeSpan.FromMilliseconds(ShouldNotDelayQuery ? 0 : 200));
|
||||
}
|
||||
|
||||
private void FireAfterWoxQueryEvent(Query q)
|
||||
{
|
||||
if (AfterWoxQueryEvent != null)
|
||||
{
|
||||
//We shouldn't let those events slow down real query
|
||||
//so I put it in the new thread
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
AfterWoxQueryEvent(new WoxQueryEventArgs()
|
||||
{
|
||||
Query = q
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void FireBeforeWoxQueryEvent(Query q)
|
||||
{
|
||||
if (BeforeWoxQueryEvent != null)
|
||||
{
|
||||
//We shouldn't let those events slow down real query
|
||||
//so I put it in the new thread
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
BeforeWoxQueryEvent(new WoxQueryEventArgs()
|
||||
{
|
||||
Query = q
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void Query(Query q)
|
||||
{
|
||||
try
|
||||
|
|
@ -532,7 +568,7 @@ namespace Wox
|
|||
case Key.Back:
|
||||
if (BackKeyDownEvent != null)
|
||||
{
|
||||
BackKeyDownEvent(tbQuery, new WoxKeyDownEventArgs()
|
||||
BackKeyDownEvent(new WoxKeyDownEventArgs()
|
||||
{
|
||||
Query = tbQuery.Text,
|
||||
keyEventArgs = e
|
||||
|
|
@ -623,7 +659,7 @@ namespace Wox
|
|||
}
|
||||
}
|
||||
|
||||
private void OnUpdateResultView(List<Result> list)
|
||||
private void OnUpdateResultView(List<Result> list, bool clearBeforeInsert = false)
|
||||
{
|
||||
queryHasReturn = true;
|
||||
progressBar.Dispatcher.Invoke(new Action(StopProgress));
|
||||
|
|
@ -639,8 +675,13 @@ namespace Wox
|
|||
});
|
||||
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
pnlResult.AddResults(l))
|
||||
);
|
||||
{
|
||||
if (clearBeforeInsert)
|
||||
{
|
||||
pnlResult.Clear();
|
||||
}
|
||||
pnlResult.AddResults(l);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@
|
|||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHotkey">
|
||||
<HintPath>..\packages\NHotkey.1.1.0.0\lib\NHotkey.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="NHotkey, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NHotkey.1.2.1\lib\net20\NHotkey.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHotkey.Wpf">
|
||||
<HintPath>..\packages\NHotkey.Wpf.1.1.0.0\lib\NHotkey.Wpf.dll</HintPath>
|
||||
<HintPath>..\packages\NHotkey.Wpf.1.2.1\lib\net35\NHotkey.Wpf.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework.Classic" />
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<packages>
|
||||
<package id="InputSimulator" version="1.0.4.0" targetFramework="net35" />
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.7" targetFramework="net35" />
|
||||
<package id="NHotkey" version="1.1.0.0" targetFramework="net35" />
|
||||
<package id="NHotkey.Wpf" version="1.1.0.0" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="NHotkey" version="1.2.1" targetFramework="net35" />
|
||||
<package id="NHotkey.Wpf" version="1.2.1" targetFramework="net35" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net35" />
|
||||
</packages>
|
||||
Loading…
Reference in a new issue