mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Allow drag drop to install wox plugin.
This commit is contained in:
6
Wox.sln
6
Wox.sln
@@ -15,8 +15,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.SystemPlugins",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Infrastructure", "Wox.Infrastructure\Wox.Infrastructure.csproj", "{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Infrastructure", "Wox.Infrastructure\Wox.Infrastructure.csproj", "{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.UAC", "Wox.UAC\Wox.UAC.csproj", "{C9BC17A0-C2BC-4185-AC1F-32E3352C1233}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.PluginManagement", "Plugins\Wox.Plugin.PluginManagement\Wox.Plugin.PluginManagement.csproj", "{049490F0-ECD2-4148-9B39-2135EC346EBE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.PluginManagement", "Plugins\Wox.Plugin.PluginManagement\Wox.Plugin.PluginManagement.csproj", "{049490F0-ECD2-4148-9B39-2135EC346EBE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.BrowserBookmark", "Plugins\Wox.Plugin.BrowserBookmark\Wox.Plugin.BrowserBookmark.csproj", "{9B130CC5-14FB-41FF-B310-0A95B6894C37}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.BrowserBookmark", "Plugins\Wox.Plugin.BrowserBookmark\Wox.Plugin.BrowserBookmark.csproj", "{9B130CC5-14FB-41FF-B310-0A95B6894C37}"
|
||||||
@@ -49,10 +47,6 @@ Global
|
|||||||
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{C9BC17A0-C2BC-4185-AC1F-32E3352C1233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C9BC17A0-C2BC-4185-AC1F-32E3352C1233}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C9BC17A0-C2BC-4185-AC1F-32E3352C1233}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C9BC17A0-C2BC-4185-AC1F-32E3352C1233}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Any CPU.ActiveCfg = Debug|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|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ namespace Wox {
|
|||||||
}
|
}
|
||||||
PluginInstaller.Install(path);
|
PluginInstaller.Install(path);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Args.Length > 0 && e.Args[0].ToLower() == "plugindebugger") {
|
if (e.Args.Length > 0 && e.Args[0].ToLower() == "plugindebugger") {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
Deactivated="MainWindow_OnDeactivated"
|
Deactivated="MainWindow_OnDeactivated"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
WindowStartupLocation="Manual"
|
WindowStartupLocation="Manual"
|
||||||
|
Drop="MainWindow_OnDrop"
|
||||||
|
AllowDrop="True"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Style="{DynamicResource WindowStyle}"
|
Style="{DynamicResource WindowStyle}"
|
||||||
Icon="Images\app.png"
|
Icon="Images\app.png"
|
||||||
@@ -18,7 +20,7 @@
|
|||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown">
|
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBox Style="{DynamicResource QueryBoxStyle}" Grid.Row="0" x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
|
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True" Grid.Row="0" x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
|
||||||
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Grid.Row="1" Height="2" StrokeThickness="1"></Line>
|
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Grid.Row="1" Height="2" StrokeThickness="1"></Line>
|
||||||
<wox:ResultPanel x:Name="resultCtrl" Grid.Row="2"/>
|
<wox:ResultPanel x:Name="resultCtrl" Grid.Row="2"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using Application = System.Windows.Application;
|
|||||||
using Brushes = System.Windows.Media.Brushes;
|
using Brushes = System.Windows.Media.Brushes;
|
||||||
using Color = System.Windows.Media.Color;
|
using Color = System.Windows.Media.Color;
|
||||||
using ContextMenu = System.Windows.Forms.ContextMenu;
|
using ContextMenu = System.Windows.Forms.ContextMenu;
|
||||||
|
using DragEventArgs = System.Windows.DragEventArgs;
|
||||||
using FontFamily = System.Windows.Media.FontFamily;
|
using FontFamily = System.Windows.Media.FontFamily;
|
||||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||||
using MenuItem = System.Windows.Forms.MenuItem;
|
using MenuItem = System.Windows.Forms.MenuItem;
|
||||||
@@ -39,6 +40,10 @@ namespace Wox {
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
|
private static readonly object locker = new object();
|
||||||
|
public static bool initialized = false;
|
||||||
|
|
||||||
|
private static readonly List<Result> waitShowResultList = new List<Result>();
|
||||||
private readonly GlobalHotkey globalHotkey = new GlobalHotkey();
|
private readonly GlobalHotkey globalHotkey = new GlobalHotkey();
|
||||||
private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
||||||
private readonly Storyboard progressBarStoryboard = new Storyboard();
|
private readonly Storyboard progressBarStoryboard = new Storyboard();
|
||||||
@@ -454,16 +459,25 @@ namespace Wox {
|
|||||||
|
|
||||||
queryHasReturn = true;
|
queryHasReturn = true;
|
||||||
progressBar.Dispatcher.Invoke(new Action(StopProgress));
|
progressBar.Dispatcher.Invoke(new Action(StopProgress));
|
||||||
if (list.Count > 0) {
|
if (list.Count > 0)
|
||||||
list.ForEach(
|
{
|
||||||
o => {
|
//todo:this should be opened to users, it's their choice to use it or not in their workflows
|
||||||
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o);
|
list.ForEach(
|
||||||
});
|
o =>
|
||||||
Dispatcher.DelayInvoke("ShowResult", k => resultCtrl.Dispatcher.Invoke(new Action(() => {
|
{
|
||||||
List<Result> results = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o);
|
||||||
resultCtrl.AddResults(results);
|
});
|
||||||
})), TimeSpan.FromMilliseconds(isCMDMode ? 0 : 50));
|
lock (locker)
|
||||||
}
|
{
|
||||||
|
waitShowResultList.AddRange(list);
|
||||||
|
}
|
||||||
|
Dispatcher.DelayInvoke("ShowResult", k => resultCtrl.Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
List<Result> l = waitShowResultList.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
||||||
|
waitShowResultList.Clear();
|
||||||
|
resultCtrl.AddResults(l);
|
||||||
|
})), TimeSpan.FromMilliseconds(isCMDMode ? 0 : 50));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTheme(string themeName) {
|
public void SetTheme(string themeName) {
|
||||||
@@ -514,5 +528,19 @@ namespace Wox {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MainWindow_OnDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
|
||||||
|
{
|
||||||
|
// Note that you can have more than one file.
|
||||||
|
string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
|
||||||
|
PluginInstaller.Install(files[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TbQuery_OnPreviewDragOver(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user