Refactoring FolderLink and URL plugin.

This commit is contained in:
qianlifeng
2014-07-19 10:12:11 +08:00
parent f1697313c0
commit fc66fba577
10 changed files with 231 additions and 169 deletions

BIN
Wox/Images/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -133,6 +133,8 @@ namespace Wox
return Plugins.AllPlugins;
}
public event WoxKeyDownEventHandler BackKeyDownEvent;
public void PushResults(Query query, PluginMetadata plugin, List<Result> results)
{
results.ForEach(o =>
@@ -456,31 +458,6 @@ namespace Wox
private void TbQuery_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
//when alt is pressed, the real key should be e.SystemKey
Action Shift_GoBack = () =>
{
if (e.KeyboardDevice.IsKeyDown(Key.LeftShift) || e.KeyboardDevice.IsKeyDown(Key.RightShift))
{
if (tbQuery.Text.EndsWith("\\"))
{
tbQuery.Text = tbQuery.Text.Remove(tbQuery.Text.Length - 1);
}
if (tbQuery.Text.Contains("\\"))
{
var index = tbQuery.Text.LastIndexOf("\\");
tbQuery.Text = tbQuery.Text.Remove(index) + "\\";
}
else
{
tbQuery.Text = "";
return;
}
}
tbQuery.CaretIndex = int.MaxValue;
};
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
switch (key)
{
@@ -518,17 +495,23 @@ namespace Wox
break;
case Key.Enter:
Shift_GoBack();
AcceptSelect(resultCtrl.AcceptSelect());
e.Handled = true;
break;
case Key.Back:
if (BackKeyDownEvent != null)
{
BackKeyDownEvent(tbQuery,new WoxKeyDownEventArgs()
{
Query = tbQuery.Text,
keyEventArgs = e
});
}
break;
case Key.Tab:
Shift_GoBack();
AcceptSelect(resultCtrl.AcceptSelect());
if (!tbQuery.Text.EndsWith("\\")) tbQuery.Text += "\\";
AcceptSelect(resultCtrl.AcceptSelect());
tbQuery.CaretIndex = int.MaxValue;
e.Handled = true;
break;
}

View File

@@ -377,8 +377,7 @@
<Resource Include="Images\color2.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\url1.png" />
<Resource Include="Images\url2.png" />
<Resource Include="Images\url.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />