Improve instant search ue

This commit is contained in:
qianlifeng
2015-02-04 23:16:41 +08:00
parent 5d9a94466a
commit 1d3f1fd7d0
23 changed files with 503 additions and 367 deletions

View File

@@ -9,14 +9,14 @@ using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.Folder
{
public class FolderPlugin : IPlugin, ISettingProvider,IPluginI18n
public class FolderPlugin : IPlugin, ISettingProvider, IPluginI18n
{
private static List<string> driverNames;
private PluginInitContext context;
public Control CreateSettingPanel()
{
return new FileSystemSettings(context);
return new FileSystemSettings(context.API);
}
public void Init(PluginInitContext context)
@@ -32,11 +32,38 @@ namespace Wox.Plugin.Folder
}
}
void API_ResultItemDropEvent(Result result, IDataObject dropObject,DragEventArgs e)
void API_ResultItemDropEvent(Result result, IDataObject dropObject, DragEventArgs e)
{
if (dropObject.GetDataPresent(DataFormats.FileDrop))
{
HanldeFilesDrop(result, dropObject);
}
e.Handled = true;
}
private void HanldeFilesDrop(Result targetResult, IDataObject dropObject)
{
List<string> files = ((string[])dropObject.GetData(DataFormats.FileDrop, false)).ToList();
context.API.ShowContextMenu(context.CurrentPluginMetadata, GetContextMenusForFileDrop(targetResult, files));
}
private static List<Result> GetContextMenusForFileDrop(Result targetResult, List<string> files)
{
List<Result> contextMenus = new List<Result>();
string folderPath = ((FolderLink) targetResult.ContextData).Path;
contextMenus.Add(new Result()
{
Title = "Copy to this folder",
IcoPath = "Images/copy.png",
Action = _ =>
{
MessageBox.Show("Copy");
return true;
}
});
return contextMenus;
}
private void ApiBackKeyDownEvent(WoxKeyDownEventArgs e)
{
string query = e.Query;
@@ -84,7 +111,8 @@ namespace Wox.Plugin.Folder
}
context.API.ChangeQuery(item.Path);
return false;
}
},
ContextData = item
}).ToList();
if (driverNames != null && !driverNames.Any(input.StartsWith))
@@ -98,9 +126,7 @@ namespace Wox.Plugin.Folder
results.AddRange(QueryInternal_Directory_Exists(input));
return results;
}
private void InitialDriverList()
} private void InitialDriverList()
{
if (driverNames == null)
{