mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Fix mouse click issues and add a new hotmovie plugin.
This commit is contained in:
BIN
Plugins/Wox.Plugin.HotMovies/Images/movies.png
Normal file
BIN
Plugins/Wox.Plugin.HotMovies/Images/movies.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
29
Plugins/Wox.Plugin.HotMovies/main.py
Normal file
29
Plugins/Wox.Plugin.HotMovies/main.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#encoding=utf8
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import json
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
def safeSelectText(s,path):
|
||||||
|
return s.select(path)[0].text if len(s.select(path)) > 0 else ""
|
||||||
|
|
||||||
|
def query(key):
|
||||||
|
r = requests.get('http://www.gewara.com/movie/searchMovie.xhtml')
|
||||||
|
bs = BeautifulSoup(r.text)
|
||||||
|
results = []
|
||||||
|
for i in bs.select(".ui_left .ui_media"):
|
||||||
|
res = {}
|
||||||
|
score = safeSelectText(i,".grade sub") + safeSelectText(i,".grade sup")
|
||||||
|
res["Title"] = safeSelectText(i,".title a") + " / " + score
|
||||||
|
res["SubTitle"] = i.select(".ui_text p")[1].text
|
||||||
|
res["ActionName"] = "openUrl"
|
||||||
|
res["IcoPath"] = "Images\\movies.png"
|
||||||
|
res["ActionPara"] = "http://www.gewara.com" + i.select(".title a")[0]["href"]
|
||||||
|
results.append(res)
|
||||||
|
return json.dumps(results)
|
||||||
|
|
||||||
|
def openUrl(context,url):
|
||||||
|
webbrowser.open(url)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print query("movie geo")
|
||||||
BIN
Plugins/Wox.Plugin.HotMovies/main.pyc
Normal file
BIN
Plugins/Wox.Plugin.HotMovies/main.pyc
Normal file
Binary file not shown.
11
Plugins/Wox.Plugin.HotMovies/plugin.json
Normal file
11
Plugins/Wox.Plugin.HotMovies/plugin.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"ID":"D2D2C23B084D411DB66FE0C79D6C2A7D",
|
||||||
|
"ActionKeyword":"hotmovie",
|
||||||
|
"Name":"近期热映电影",
|
||||||
|
"Description":"近期热映电影,powered by 格瓦拉",
|
||||||
|
"Author":"qianlifeng",
|
||||||
|
"Version":"1.0",
|
||||||
|
"Language":"python",
|
||||||
|
"Website":"http://www.getwox.com",
|
||||||
|
"ExecuteFileName":"main.py"
|
||||||
|
}
|
||||||
22
Wox.Plugin/Wox.Plugin.PluginManagement/Main.cs
Normal file
22
Wox.Plugin/Wox.Plugin.PluginManagement/Main.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.PluginManagement
|
||||||
|
{
|
||||||
|
public class Main:IPlugin
|
||||||
|
{
|
||||||
|
private PluginInitContext context;
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的常规信息通过以下
|
||||||
|
// 特性集控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("Wox.Plugin.PluginManagement")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Wox.Plugin.PluginManagement")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||||
|
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||||
|
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("92b59bab-5c8c-414b-a8d7-326c7be3a11d")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下面四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
|
// 方法是按如下所示使用“*”:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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>{049490F0-ECD2-4148-9B39-2135EC346EBE}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Wox.Plugin.PluginManagement</RootNamespace>
|
||||||
|
<AssemblyName>Wox.Plugin.PluginManagement</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<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="Main.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Wox.Plugin.csproj">
|
||||||
|
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||||
|
<Name>Wox.Plugin</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- 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>
|
||||||
31
Wox.sln
31
Wox.sln
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.UAC", "Wox.UAC\Wox.UAC.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Clipboard", "Plugins\Wox.Plugin.Clipboard\Wox.Plugin.Clipboard.csproj", "{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Clipboard", "Plugins\Wox.Plugin.Clipboard\Wox.Plugin.Clipboard.csproj", "{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.PluginManagement", "Wox.Plugin\Wox.Plugin.PluginManagement\Wox.Plugin.PluginManagement.csproj", "{049490F0-ECD2-4148-9B39-2135EC346EBE}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -376,6 +378,34 @@ Global
|
|||||||
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|Win32.ActiveCfg = Release|Any CPU
|
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|Win32.ActiveCfg = Release|Any CPU
|
||||||
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|x64.ActiveCfg = Release|Any CPU
|
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|x64.ActiveCfg = Release|Any CPU
|
||||||
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|x86.ActiveCfg = Release|Any CPU
|
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2}.UnitTests|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.EmbeddingTest|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.UnitTests|x86.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -385,5 +415,6 @@ Global
|
|||||||
{6B6696B1-A547-4FD4-85EF-E1FD0F54AD2C} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
{6B6696B1-A547-4FD4-85EF-E1FD0F54AD2C} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||||
{230AE83F-E92E-4E69-8355-426B305DA9C0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
{230AE83F-E92E-4E69-8355-426B305DA9C0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||||
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
{8C14DC11-2737-4DCB-A121-5D7BDD57FEA2} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||||
|
{049490F0-ECD2-4148-9B39-2135EC346EBE} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ namespace Wox
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
progressBar.ToolTip = toolTip;
|
progressBar.ToolTip = toolTip;
|
||||||
InitialTray();
|
InitialTray();
|
||||||
|
resultCtrl.OnMouseClickItem += AcceptSelect;
|
||||||
|
|
||||||
ThreadPool.SetMaxThreads(30, 10);
|
ThreadPool.SetMaxThreads(30, 10);
|
||||||
InitProgressbarAnimation();
|
InitProgressbarAnimation();
|
||||||
@@ -60,8 +61,6 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
||||||
{
|
{
|
||||||
var hotkey = new HotkeyModel(hotkeyStr);
|
var hotkey = new HotkeyModel(hotkeyStr);
|
||||||
@@ -285,15 +284,14 @@ namespace Wox
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Key.Enter:
|
case Key.Enter:
|
||||||
AcceptSelect();
|
AcceptSelect(resultCtrl.AcceptSelect());
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AcceptSelect()
|
private void AcceptSelect(Result result)
|
||||||
{
|
{
|
||||||
Result result = resultCtrl.AcceptSelect();
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
if (result.Action != null)
|
if (result.Action != null)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Python.Runtime;
|
using Python.Runtime;
|
||||||
@@ -33,6 +34,7 @@ namespace Wox.PluginLoader
|
|||||||
private bool CheckPythonEnvironmentInstalled() {
|
private bool CheckPythonEnvironmentInstalled() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
SetPythonHome();
|
||||||
PythonEngine.Initialize();
|
PythonEngine.Initialize();
|
||||||
PythonEngine.Shutdown();
|
PythonEngine.Shutdown();
|
||||||
}
|
}
|
||||||
@@ -42,5 +44,12 @@ namespace Wox.PluginLoader
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetPythonHome()
|
||||||
|
{
|
||||||
|
//Environment.SetEnvironmentVariable("PYTHONHOME",Path.Combine(Directory.GetCurrentDirectory(),"PythonHome"));
|
||||||
|
//PythonEngine.PythonHome =
|
||||||
|
//PythonEngine.ProgramName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid x:Name="gridContainer">
|
<Grid x:Name="gridContainer">
|
||||||
<ListBox x:Name="lbResults" Style="{DynamicResource listboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
|
<ListBox x:Name="lbResults" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource listboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<!--SelectedItem with focus-->
|
<!--SelectedItem with focus-->
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ResultItemHighlightBackgroundColor}"/>
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ResultItemHighlightBackgroundColor}"/>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Image.Source>
|
</Image.Source>
|
||||||
</Image>
|
</Image>
|
||||||
<Grid Margin="5 0 5 0" Grid.Column="1">
|
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
||||||
|
|||||||
@@ -3,15 +3,27 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
using UserControl = System.Windows.Controls.UserControl;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox
|
||||||
{
|
{
|
||||||
public partial class ResultPanel : UserControl
|
public partial class ResultPanel : UserControl
|
||||||
{
|
{
|
||||||
|
public event Action<Result> OnMouseClickItem;
|
||||||
|
|
||||||
|
protected virtual void OnOnMouseClickItem(Result result)
|
||||||
|
{
|
||||||
|
Action<Result> handler = OnMouseClickItem;
|
||||||
|
if (handler != null) handler(result);
|
||||||
|
}
|
||||||
|
|
||||||
public bool Dirty { get; set; }
|
public bool Dirty { get; set; }
|
||||||
|
|
||||||
public void AddResults(List<Result> results)
|
public void AddResults(List<Result> results)
|
||||||
@@ -141,5 +153,14 @@ namespace Wox
|
|||||||
lbResults.ScrollIntoView(e.AddedItems[0]);
|
lbResults.ScrollIntoView(e.AddedItems[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LbResults_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var item = ItemsControl.ContainerFromElement(lbResults, e.OriginalSource as DependencyObject) as ListBoxItem;
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
OnOnMouseClickItem(item.DataContext as Result);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user