From e1f71cae37e8f4b89588b3765f8d1721dc93eab4 Mon Sep 17 00:00:00 2001 From: cxfksword Date: Mon, 24 Mar 2014 00:51:07 +0800 Subject: [PATCH] Change Directory plugin subdirectory list action --- Wox.Plugin.System/DirectoryIndicator.cs | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Wox.Plugin.System/DirectoryIndicator.cs b/Wox.Plugin.System/DirectoryIndicator.cs index dfc8dcc6b0..3f76b69be3 100644 --- a/Wox.Plugin.System/DirectoryIndicator.cs +++ b/Wox.Plugin.System/DirectoryIndicator.cs @@ -10,6 +10,7 @@ namespace Wox.Plugin.System { public class DirectoryIndicator : BaseSystemPlugin { + private PluginInitContext context; private static List driverNames = null; private static Dictionary parentDirectories = new Dictionary(); @@ -25,6 +26,8 @@ namespace Wox.Plugin.System return results; } + InitialDriverList(); + var input = query.RawQuery.ToLower(); if (driverNames.FirstOrDefault(x => input.StartsWith(x)) == null) return results; @@ -49,12 +52,11 @@ namespace Wox.Plugin.System Result result = new Result { Title = dir.Name, - SubTitle = "Open this directory", IcoPath = "Images/folder.png", Action = (c) => { - Process.Start(dirPath); - return true; + context.ChangeQuery(dirPath); + return false; } }; results.Add(result); @@ -64,9 +66,14 @@ namespace Wox.Plugin.System { Result result = new Result { - Title = "No files in this directory", - SubTitle = "", + Title = "Open this directory", + SubTitle = "No files in this directory", IcoPath = "Images/folder.png", + Action = (c) => + { + Process.Start(query.RawQuery); + return true; + } }; results.Add(result); } @@ -111,12 +118,11 @@ namespace Wox.Plugin.System Result result = new Result { Title = dir.Name, - SubTitle = "Open this directory", IcoPath = "Images/folder.png", Action = (c) => { - Process.Start(dirPath); - return true; + context.ChangeQuery(dirPath); + return false; } }; results.Add(result); @@ -128,7 +134,7 @@ namespace Wox.Plugin.System return results; } - protected override void InitInternal(PluginInitContext context) + private void InitialDriverList() { if (driverNames == null) { @@ -141,5 +147,10 @@ namespace Wox.Plugin.System } } + protected override void InitInternal(PluginInitContext context) + { + this.context = context; + } + } }