mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Refactoring FolderLink and URL plugin.
This commit is contained in:
BIN
Wox/Images/file.png
Normal file
BIN
Wox/Images/file.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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')" />
|
||||
|
||||
Reference in New Issue
Block a user