mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Merge branch 'V1.2.0' of https://github.com/qianlifeng/Wox into V1.2.0
This commit is contained in:
BIN
Plugins/Wox.Plugin.Program/Images/folder.png
Normal file
BIN
Plugins/Wox.Plugin.Program/Images/folder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -16,7 +16,8 @@ namespace Wox.Plugin.Program.ProgramSources
|
|||||||
this.baseDirectory = baseDirectory;
|
this.baseDirectory = baseDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileSystemProgramSource(ProgramSource source):this(source.Location)
|
public FileSystemProgramSource(ProgramSource source)
|
||||||
|
: this(source.Location)
|
||||||
{
|
{
|
||||||
this.BonusPoints = source.BonusPoints;
|
this.BonusPoints = source.BonusPoints;
|
||||||
}
|
}
|
||||||
@@ -50,17 +51,9 @@ namespace Wox.Plugin.Program.ProgramSources
|
|||||||
GetAppFromDirectory(subDirectory, list);
|
GetAppFromDirectory(subDirectory, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (UnauthorizedAccessException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.Warn(string.Format("Can't access to directory {0}", path));
|
Log.Warn(string.Format("GetAppFromDirectory failed: {0} - {1}", path, e.Message));
|
||||||
}
|
|
||||||
catch (DirectoryNotFoundException e)
|
|
||||||
{
|
|
||||||
Log.Warn(string.Format("Directory {0} doesn't exist", path));
|
|
||||||
}
|
|
||||||
catch (PathTooLongException e)
|
|
||||||
{
|
|
||||||
Log.Warn(string.Format("File path too long: {0}", e.Message));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ namespace Wox.Plugin.Program
|
|||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
this.context.API.ResultItemDropEvent += API_ResultItemDropEvent;
|
||||||
using (new Timeit("Preload programs"))
|
using (new Timeit("Preload programs"))
|
||||||
{
|
{
|
||||||
programs = ProgramCacheStorage.Instance.Programs;
|
programs = ProgramCacheStorage.Instance.Programs;
|
||||||
@@ -114,6 +115,11 @@ namespace Wox.Plugin.Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void API_ResultItemDropEvent(Result result, IDataObject dropObject)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void IndexPrograms()
|
public static void IndexPrograms()
|
||||||
{
|
{
|
||||||
lock (lockObject)
|
lock (lockObject)
|
||||||
|
|||||||
@@ -1,150 +1,153 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
|
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Wox.Plugin.Program</RootNamespace>
|
<RootNamespace>Wox.Plugin.Program</RootNamespace>
|
||||||
<AssemblyName>Wox.Plugin.Program</AssemblyName>
|
<AssemblyName>Wox.Plugin.Program</AssemblyName>
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
<RestorePackages>true</RestorePackages>
|
<RestorePackages>true</RestorePackages>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
|
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Program\</OutputPath>
|
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Program\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FileChangeWatcher.cs" />
|
<Compile Include="FileChangeWatcher.cs" />
|
||||||
<Compile Include="IProgramSource.cs" />
|
<Compile Include="IProgramSource.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="ProgramCacheStorage.cs" />
|
<Compile Include="ProgramCacheStorage.cs" />
|
||||||
<Compile Include="Programs.cs" />
|
<Compile Include="Programs.cs" />
|
||||||
<Compile Include="ProgramSetting.xaml.cs">
|
<Compile Include="ProgramSetting.xaml.cs">
|
||||||
<DependentUpon>ProgramSetting.xaml</DependentUpon>
|
<DependentUpon>ProgramSetting.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ProgramSource.cs" />
|
<Compile Include="ProgramSource.cs" />
|
||||||
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
|
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
|
||||||
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
|
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
|
||||||
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
|
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
|
||||||
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
|
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
|
||||||
<Compile Include="ProgramStorage.cs" />
|
<Compile Include="ProgramStorage.cs" />
|
||||||
<Compile Include="ProgramSuffixes.xaml.cs">
|
<Compile Include="ProgramSuffixes.xaml.cs">
|
||||||
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
|
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="StringEmptyConverter.cs" />
|
<Compile Include="StringEmptyConverter.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="plugin.json">
|
<None Include="plugin.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Images\program.png">
|
<None Include="Images\program.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Images\cmd.png">
|
<None Include="Images\cmd.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<Content Include="Languages\en.xaml">
|
<None Include="Images\folder.png">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<SubType>Designer</SubType>
|
</None>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<Content Include="Languages\en.xaml">
|
||||||
</Content>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</ItemGroup>
|
<SubType>Designer</SubType>
|
||||||
<ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Languages\zh-cn.xaml">
|
</Content>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</ItemGroup>
|
||||||
<SubType>Designer</SubType>
|
<ItemGroup>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<None Include="Languages\zh-cn.xaml">
|
||||||
</None>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<None Include="Languages\zh-tw.xaml">
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<SubType>Designer</SubType>
|
</None>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<None Include="Languages\zh-tw.xaml">
|
||||||
</None>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<Page Include="ProgramSetting.xaml">
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<SubType>Designer</SubType>
|
</None>
|
||||||
</Page>
|
<Page Include="ProgramSetting.xaml">
|
||||||
<Page Include="ProgramSuffixes.xaml">
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<SubType>Designer</SubType>
|
||||||
<SubType>Designer</SubType>
|
</Page>
|
||||||
</Page>
|
<Page Include="ProgramSuffixes.xaml">
|
||||||
</ItemGroup>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<ItemGroup>
|
<SubType>Designer</SubType>
|
||||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
</Page>
|
||||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
</ItemGroup>
|
||||||
<Name>Wox.Infrastructure</Name>
|
<ItemGroup>
|
||||||
</ProjectReference>
|
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||||
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
<Name>Wox.Infrastructure</Name>
|
||||||
<Name>Wox.Plugin</Name>
|
</ProjectReference>
|
||||||
</ProjectReference>
|
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||||
</ItemGroup>
|
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||||
<ItemGroup>
|
<Name>Wox.Plugin</Name>
|
||||||
<COMReference Include="IWshRuntimeLibrary">
|
</ProjectReference>
|
||||||
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
</ItemGroup>
|
||||||
<VersionMajor>1</VersionMajor>
|
<ItemGroup>
|
||||||
<VersionMinor>0</VersionMinor>
|
<COMReference Include="IWshRuntimeLibrary">
|
||||||
<Lcid>0</Lcid>
|
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
||||||
<WrapperTool>tlbimp</WrapperTool>
|
<VersionMajor>1</VersionMajor>
|
||||||
<Isolated>False</Isolated>
|
<VersionMinor>0</VersionMinor>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<Lcid>0</Lcid>
|
||||||
</COMReference>
|
<WrapperTool>tlbimp</WrapperTool>
|
||||||
</ItemGroup>
|
<Isolated>False</Isolated>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
</COMReference>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
</PropertyGroup>
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
<PropertyGroup>
|
||||||
</Target>
|
<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.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -22,8 +22,8 @@ namespace Wox.Core.Updater
|
|||||||
{
|
{
|
||||||
private static UpdaterManager instance;
|
private static UpdaterManager instance;
|
||||||
private const string VersionCheckURL = "https://api.getwox.com/release/latest/";
|
private const string VersionCheckURL = "https://api.getwox.com/release/latest/";
|
||||||
//private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
|
private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
|
||||||
private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
|
//private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
|
||||||
private static SemanticVersion currentVersion;
|
private static SemanticVersion currentVersion;
|
||||||
|
|
||||||
public event EventHandler PrepareUpdateReady;
|
public event EventHandler PrepareUpdateReady;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Wox.Plugin
|
namespace Wox.Plugin
|
||||||
@@ -9,6 +10,8 @@ namespace Wox.Plugin
|
|||||||
public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e);
|
public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e);
|
||||||
public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e);
|
public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e);
|
||||||
|
|
||||||
|
public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Global keyboard events
|
/// Global keyboard events
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -119,5 +119,10 @@ namespace Wox.Plugin
|
|||||||
/// Fired before wox start to execute a query
|
/// Fired before wox start to execute a query
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fired after drop to result item of current plugin
|
||||||
|
/// </summary>
|
||||||
|
event ResultItemDropEventHandler ResultItemDropEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using MenuItem = System.Windows.Forms.MenuItem;
|
|||||||
using MessageBox = System.Windows.MessageBox;
|
using MessageBox = System.Windows.MessageBox;
|
||||||
using ToolTip = System.Windows.Controls.ToolTip;
|
using ToolTip = System.Windows.Controls.ToolTip;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
using IDataObject = System.Windows.IDataObject;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox
|
||||||
{
|
{
|
||||||
@@ -135,6 +136,7 @@ namespace Wox
|
|||||||
public event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
public event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||||
public event AfterWoxQueryEventHandler AfterWoxQueryEvent;
|
public event AfterWoxQueryEventHandler AfterWoxQueryEvent;
|
||||||
public event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
public event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
|
||||||
|
public event ResultItemDropEventHandler ResultItemDropEvent;
|
||||||
|
|
||||||
public void PushResults(Query query, PluginMetadata plugin, List<Result> results)
|
public void PushResults(Query query, PluginMetadata plugin, List<Result> results)
|
||||||
{
|
{
|
||||||
@@ -168,6 +170,7 @@ namespace Wox
|
|||||||
progressBar.ToolTip = toolTip;
|
progressBar.ToolTip = toolTip;
|
||||||
InitialTray();
|
InitialTray();
|
||||||
pnlResult.LeftMouseClickEvent += SelectResult;
|
pnlResult.LeftMouseClickEvent += SelectResult;
|
||||||
|
pnlResult.ItemDropEvent += pnlResult_ItemDropEvent;
|
||||||
pnlContextMenu.LeftMouseClickEvent += SelectResult;
|
pnlContextMenu.LeftMouseClickEvent += SelectResult;
|
||||||
pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent;
|
pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent;
|
||||||
|
|
||||||
@@ -192,6 +195,19 @@ namespace Wox
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject)
|
||||||
|
{
|
||||||
|
if (ResultItemDropEvent != null)
|
||||||
|
{
|
||||||
|
PluginPair pluginPair = PluginManager.AllPlugins.FirstOrDefault(o => o.Plugin == ResultItemDropEvent.Target);
|
||||||
|
if (pluginPair != null)
|
||||||
|
{
|
||||||
|
//todo:
|
||||||
|
ResultItemDropEvent(result, dropDataObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
|
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
|
||||||
{
|
{
|
||||||
if (GlobalKeyboardEvent != null)
|
if (GlobalKeyboardEvent != null)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100">
|
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100">
|
||||||
|
|
||||||
<!-- set max height of listbox to allow 6 results showed at once -->
|
<!-- set max height of listbox to allow 6 results showed at once -->
|
||||||
<ListBox x:Name="lbResults" MaxHeight="300" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
<ListBox x:Name="lbResults" MaxHeight="300" AllowDrop="True" Drop="ListBoxItem_OnDrop" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<!--SelectedItem with focus-->
|
<!--SelectedItem with focus-->
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
public event Action<Result> LeftMouseClickEvent;
|
public event Action<Result> LeftMouseClickEvent;
|
||||||
public event Action<Result> RightMouseClickEvent;
|
public event Action<Result> RightMouseClickEvent;
|
||||||
|
public event Action<Result,IDataObject> ItemDropEvent;
|
||||||
|
|
||||||
protected virtual void OnRightMouseClick(Result result)
|
protected virtual void OnRightMouseClick(Result result)
|
||||||
{
|
{
|
||||||
@@ -208,5 +209,20 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
Select(index);
|
Select(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ListBoxItem_OnDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
var item = ItemsControl.ContainerFromElement(lbResults, e.OriginalSource as DependencyObject) as ListBoxItem;
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
OnItemDropEvent(item.DataContext as Result,e.Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnItemDropEvent(Result obj, IDataObject data)
|
||||||
|
{
|
||||||
|
var handler = ItemDropEvent;
|
||||||
|
if (handler != null) handler(obj,data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user