diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index 368d66f77a..12a2e3ed53 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,23 +1,21 @@
## English
-Before you report any bugs try search existing issues
+Try search existing issues before you open new one
-1. Please specify Wox version
- - If you checkout from master/dev branch, please specify **commit number**
-2. Please describe the steps to **reproduce** the bug
-3. Please provide Windows version
-4. Please provide Exception info if you have.
-5. Please provide **logs** from `%APPDATA%\Wox\Logs` if you have.
-6. Please provide screenshot if you have
+1. Wox version / commit number:
+2. Steps to **reproduce** the bug:
+3. Windows version:
+4. Exception:
+5. **whole** log file (`%APPDATA%\Wox\Logs\version\date.txt`):
+6. Screenshot (optional):
## 中文 / Chinese
-报 bug 之前搜索一下已经有的 issue
+提问之前搜索一下已经有的 issue
-1. 请提供 Wox 版本
- - 如果你是从 master/dev branch checkout 的,请提供 **commit number**
-2. 请提供如何**重现** bug 的步骤
-3. 请提供 Windows 版本
-4. 如果有 Exception/Crash Report 的话,请一并提供
-5. 如果有 **logs** (`%APPDATA%\Wox\Logs`)的话,请一并提供
-6. 如果有截图的话,请一并提供
+1. Wox 版本 / commit number:
+2. 如何**重现** bug:
+3. Windows 版本:
+4. Exception:
+5. **整个** log 文件 (`%APPDATA%\Wox\Logs\version\date.txt`):
+6. 截图 (可选):
diff --git a/Plugins/Wox.Plugin.Everything/Languages/de.xaml b/Plugins/Wox.Plugin.Everything/Languages/de.xaml
index ba4cfe9add..49cde761a8 100644
--- a/Plugins/Wox.Plugin.Everything/Languages/de.xaml
+++ b/Plugins/Wox.Plugin.Everything/Languages/de.xaml
@@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
- Everything läuft nicht
+ Everything Service läuft nicht
Everything Plugin hat einen Fehler (drücke Enter zum kopieren der Fehlernachricht)
kopiert
Kann {0} nicht starten
diff --git a/Plugins/Wox.Plugin.Everything/Languages/en.xaml b/Plugins/Wox.Plugin.Everything/Languages/en.xaml
index a076308253..5cd3c559e8 100644
--- a/Plugins/Wox.Plugin.Everything/Languages/en.xaml
+++ b/Plugins/Wox.Plugin.Everything/Languages/en.xaml
@@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
- Everything is not running
+ Everything Service is not running
Error while querying Everything
Copied
Can’t start {0}
diff --git a/Plugins/Wox.Plugin.Everything/Languages/pl.xaml b/Plugins/Wox.Plugin.Everything/Languages/pl.xaml
index 37c39db1ca..3c1bf2a38b 100644
--- a/Plugins/Wox.Plugin.Everything/Languages/pl.xaml
+++ b/Plugins/Wox.Plugin.Everything/Languages/pl.xaml
@@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
- Program Everything nie jest uruchomiony
+ Everything Service nie jest uruchomiony
Wystąpił błąd podczas pobierania wyników z Everything
Skopiowano
Nie udało się uruchomić {0}
diff --git a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml
index 309b59e488..b6baffb359 100644
--- a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml
+++ b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml
@@ -2,14 +2,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
- Everything没有运行
- Everything插件发生了一个错误(回车拷贝具体错误信息)
+ Everything Service 没有运行
+ Everything 插件发生了一个错误(回车拷贝具体错误信息)
拷贝成功
不能启动 {0}
打开所属文件夹
Everything
- 利用Everything搜索磁盘文件
+ 利用 Everything 搜索磁盘文件
使用应用程序的位置为可执行的工作目录
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml b/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml
index 40651d9ed4..b70d73202b 100644
--- a/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml
+++ b/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml
@@ -2,14 +2,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
- Everything沒有運行
- Everything插件發生了一個錯誤(回車拷貝具體錯誤信息)
+ Everything Service 沒有運行
+ Everything 插件發生了一個錯誤(回車拷貝具體錯誤信息)
拷貝成功
不能啟動 {0}
打開所屬文件夾
Everything
- 利用Everything搜索磁盤文件
+ 利用 Everything 搜索磁盤文件
使用应用程序的位置为可执行的工作目录
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Everything/Main.cs b/Plugins/Wox.Plugin.Everything/Main.cs
index 231d94d0c2..c08efc85b7 100644
--- a/Plugins/Wox.Plugin.Everything/Main.cs
+++ b/Plugins/Wox.Plugin.Everything/Main.cs
@@ -142,6 +142,7 @@ namespace Wox.Plugin.Everything
Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);
var sdkPath = Path.Combine(sdkDirectory, DLL);
+ Constant.EverythingSDKPath = sdkPath;
LoadLibrary(sdkPath);
}
diff --git a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs
index 253bce41ff..507626eb05 100644
--- a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Windows;
using System.Windows.Forms;
+using Wox.Plugin.Program.ProgramSources;
namespace Wox.Plugin.Program
{
@@ -9,7 +10,7 @@ namespace Wox.Plugin.Program
///
public partial class AddProgramSource
{
- private ProgramSource _editing;
+ private FileSystemProgramSource _editing;
private Settings _settings;
public AddProgramSource(Settings settings)
@@ -20,7 +21,7 @@ namespace Wox.Plugin.Program
Directory.Focus();
}
- public AddProgramSource(ProgramSource edit, Settings settings)
+ public AddProgramSource(FileSystemProgramSource edit, Settings settings)
{
_editing = edit;
_settings = settings;
@@ -51,12 +52,11 @@ namespace Wox.Plugin.Program
if(_editing == null)
{
- var source = new ProgramSource
+ var source = new FileSystemProgramSource
{
Location = Directory.Text,
MaxDepth = max,
Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator),
- Type = "FileSystemProgramSource",
Enabled = true
};
_settings.ProgramSources.Add(source);
diff --git a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs
index 0ab797d9c9..95853d4628 100644
--- a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs
+++ b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs
@@ -1,33 +1,31 @@
using System.Collections.Generic;
using System.IO;
-using System.Threading;
using System.Threading.Tasks;
using Wox.Infrastructure.Logger;
namespace Wox.Plugin.Program
{
- internal class FileChangeWatcher
+ internal static class FileChangeWatcher
{
- private static bool isIndexing;
- private static List watchedPath = new List();
+ private static readonly List WatchedPath = new List();
public static void AddWatch(string path, string[] programSuffixes, bool includingSubDirectory = true)
{
- if (watchedPath.Contains(path)) return;
+ if (WatchedPath.Contains(path)) return;
if (!Directory.Exists(path))
{
Log.Warn($"FileChangeWatcher: {path} doesn't exist");
return;
}
- watchedPath.Add(path);
+ WatchedPath.Add(path);
foreach (string fileType in programSuffixes)
{
FileSystemWatcher watcher = new FileSystemWatcher
{
Path = path,
IncludeSubdirectories = includingSubDirectory,
- Filter = string.Format("*.{0}", fileType),
+ Filter = $"*.{fileType}",
EnableRaisingEvents = true
};
watcher.Changed += FileChanged;
@@ -39,15 +37,10 @@ namespace Wox.Plugin.Program
private static void FileChanged(object source, FileSystemEventArgs e)
{
- if (!isIndexing)
+ Task.Run(() =>
{
- Task.Run(() =>
- {
- Main.IndexPrograms();
- isIndexing = false;
- });
- }
+ Main.IndexPrograms();
+ });
}
-
}
}
diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs
index bb0beb7f5f..851907cfb7 100644
--- a/Plugins/Wox.Plugin.Program/Main.cs
+++ b/Plugins/Wox.Plugin.Program/Main.cs
@@ -14,16 +14,7 @@ namespace Wox.Plugin.Program
{
public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable
{
- private static object lockObject = new object();
private static List _programs = new List();
- private static List _sources = new List();
- private static readonly Dictionary SourceTypes = new Dictionary
- {
- {"FileSystemProgramSource", typeof(FileSystemProgramSource)},
- {"CommonStartMenuProgramSource", typeof(CommonStartMenuProgramSource)},
- {"UserStartMenuProgramSource", typeof(UserStartMenuProgramSource)},
- {"AppPathsProgramSource", typeof(AppPathsProgramSource)}
- };
private PluginInitContext _context;
@@ -36,8 +27,15 @@ namespace Wox.Plugin.Program
{
_settingsStorage = new PluginJsonStorage();
_settings = _settingsStorage.Load();
- _cacheStorage = new BinaryStorage();
- _cache = _cacheStorage.Load();
+
+ Stopwatch.Debug("Preload programs", () =>
+ {
+ _cacheStorage = new BinaryStorage();
+ _cache = _cacheStorage.Load();
+ _programs = _cache.Programs;
+ });
+ Log.Info($"Preload {_programs.Count} programs from cache");
+ Stopwatch.Debug("Program Index", IndexPrograms);
}
public void Save()
@@ -50,29 +48,35 @@ namespace Wox.Plugin.Program
{
var results = _programs.AsParallel()
.Where(p => Score(p, query.Search) > 0)
- .Select(ScoreFilter)
.OrderByDescending(p => p.Score)
- .Select(p => new Result
- {
- Title = p.Title,
- SubTitle = p.Path,
- IcoPath = p.IcoPath,
- Score = p.Score,
- ContextData = p,
- Action = e =>
- {
- var info = new ProcessStartInfo
- {
- FileName = p.Path,
- WorkingDirectory = p.Directory
- };
- var hide = StartProcess(info);
- return hide;
- }
- }).ToList();
+ .Select(ResultFromProgram)
+ .ToList();
return results;
}
+ public Result ResultFromProgram(Program p)
+ {
+ var result = new Result
+ {
+ Title = p.Title,
+ SubTitle = p.Path,
+ IcoPath = p.IcoPath,
+ Score = p.Score,
+ ContextData = p,
+ Action = e =>
+ {
+ var info = new ProcessStartInfo
+ {
+ FileName = p.Path,
+ WorkingDirectory = p.Directory
+ };
+ var hide = StartProcess(info);
+ return hide;
+ }
+ };
+ return result;
+ }
+
private int Score(Program program, string query)
{
var score1 = StringMatcher.Score(program.Title, query);
@@ -86,101 +90,83 @@ namespace Wox.Plugin.Program
public void Init(PluginInitContext context)
{
_context = context;
- Stopwatch.Debug("Preload programs", () =>
- {
- _programs = _cache.Programs;
- });
- Log.Info($"Preload {_programs.Count} programs from cache");
- Stopwatch.Debug("Program Index", IndexPrograms);
}
public static void IndexPrograms()
{
- // todo why there is a lock??
- lock (lockObject)
- {
- var sources = DefaultProgramSources();
- if (_settings.ProgramSources != null &&
- _settings.ProgramSources.Count(o => o.Enabled) > 0)
- {
- sources.AddRange(_settings.ProgramSources);
- }
+ var sources = ProgramSources();
- _sources = sources.AsParallel()
- .Where(s => s.Enabled && SourceTypes.ContainsKey(s.Type))
- .Select(s =>
- {
- var sourceClass = SourceTypes[s.Type];
- var constructorInfo = sourceClass.GetConstructor(new[] { typeof(ProgramSource) });
- var programSource = constructorInfo?.Invoke(new object[] { s }) as IProgramSource;
- return programSource;
- })
- .Where(s => s != null).ToList();
+ var programs = sources.AsParallel()
+ .SelectMany(s => s.LoadPrograms())
+ // filter duplicate program
+ .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName })
+ .Select(g => g.First());
+ programs = programs.Select(ScoreFilter);
- _programs = _sources.AsParallel()
- .SelectMany(s => s.LoadPrograms())
- // filter duplicate program
- .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName })
- .Select(g => g.First())
- .ToList();
-
- _cache.Programs = _programs;
- }
+ _programs = programs.ToList();
+ _cache.Programs = _programs;
}
- ///
- /// Load program sources that wox always provide
- ///
- private static List DefaultProgramSources()
+ private static List ProgramSources()
{
- var list = new List
+ var sources = new List
{
- new ProgramSource
+ new CommonStartMenuProgramSource
{
BonusPoints = 0,
Enabled = _settings.EnableStartMenuSource,
- Type = "CommonStartMenuProgramSource"
},
- new ProgramSource
+ new UserStartMenuProgramSource
{
BonusPoints = 0,
Enabled = _settings.EnableStartMenuSource,
- Type = "UserStartMenuProgramSource"
},
- new ProgramSource
+ new AppPathsProgramSource
{
BonusPoints = -10,
Enabled = _settings.EnableRegistrySource,
- Type = "AppPathsProgramSource"
}
};
- return list;
+
+ if (_settings.ProgramSources.Count(o => o.Enabled) > 0)
+ {
+ sources.AddRange(_settings.ProgramSources);
+ }
+
+ return sources;
}
- private Program ScoreFilter(Program p)
+ private static Program ScoreFilter(Program p)
{
p.Score += p.Source.BonusPoints;
+ var start = new[] { "启动", "start" };
+ var doc = new[] { "帮助", "help", "文档", "documentation" };
+ var uninstall = new[] { "卸载", "uninstall" };
- if (p.Title.Contains("启动") || p.Title.ToLower().Contains("start"))
+ var contained = start.Any(s => p.Title.ToLower().Contains(s));
+ if (contained)
+ {
p.Score += 10;
-
- if (p.Title.Contains("帮助") || p.Title.ToLower().Contains("help") || p.Title.Contains("文档") || p.Title.ToLower().Contains("documentation"))
+ }
+ contained = doc.Any(d => p.Title.ToLower().Contains(d));
+ if (contained)
+ {
p.Score -= 10;
-
- if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
+ }
+ contained = uninstall.Any(u => p.Title.ToLower().Contains(u));
+ if (contained)
+ {
p.Score -= 20;
+ }
+
return p;
}
- #region ISettingProvider Members
-
public Control CreateSettingPanel()
{
return new ProgramSetting(_context, _settings);
}
- #endregion
-
public string GetTranslatedPluginTitle()
{
return _context.API.GetTranslation("wox_plugin_program_plugin_name");
diff --git a/Plugins/Wox.Plugin.Program/Program.cs b/Plugins/Wox.Plugin.Program/Program.cs
index e8c59ac1fc..ff468e674e 100644
--- a/Plugins/Wox.Plugin.Program/Program.cs
+++ b/Plugins/Wox.Plugin.Program/Program.cs
@@ -2,6 +2,7 @@ using System;
using System.Text.RegularExpressions;
using System.Threading;
using Wox.Infrastructure;
+using Wox.Plugin.Program.ProgramSources;
namespace Wox.Plugin.Program
{
@@ -14,6 +15,6 @@ namespace Wox.Plugin.Program
public string Directory { get; set; }
public string ExecutableName { get; set; }
public int Score { get; set; }
- public IProgramSource Source { get; set; }
+ public ProgramSource Source { get; set; }
}
}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs
index 5f0430e2b0..f54cc7b3e6 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
+using Wox.Plugin.Program.ProgramSources;
namespace Wox.Plugin.Program
{
@@ -50,7 +51,7 @@ namespace Wox.Plugin.Program
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
{
- ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
+ var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource;
if (selectedProgramSource != null)
{
string msg = string.Format(context.API.GetTranslation("wox_plugin_program_delete_program_source"), selectedProgramSource.Location);
@@ -70,7 +71,7 @@ namespace Wox.Plugin.Program
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
{
- ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
+ var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource;
if (selectedProgramSource != null)
{
var add = new AddProgramSource(selectedProgramSource, _settings);
@@ -119,10 +120,9 @@ namespace Wox.Plugin.Program
{
if (Directory.Exists(s))
{
- _settings.ProgramSources.Add(new ProgramSource
+ _settings.ProgramSources.Add(new FileSystemProgramSource
{
Location = s,
- Type = "FileSystemProgramSource",
Enabled = true
});
diff --git a/Plugins/Wox.Plugin.Program/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSource.cs
deleted file mode 100644
index 1345c51f4a..0000000000
--- a/Plugins/Wox.Plugin.Program/ProgramSource.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Wox.Plugin.Program
-{
- [Serializable]
- public class ProgramSource
- {
- public string Location { get; set; }
- public string Type { get; set; }
- public int BonusPoints { get; set; }
- public bool Enabled { get; set; }
- // happlebao todo: temp hack for program suffixes
- public string[] Suffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
- public const char SuffixSeperator = ';';
- public int MaxDepth { get; set; }
- public Dictionary Meta { get; set; }
-
- public override string ToString()
- {
- return (Type ?? "") + ":" + Location ?? "";
- }
- }
-}
diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs
index 47c2b7bae5..9f86e868f4 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.IO;
using Microsoft.Win32;
using Wox.Infrastructure.Logger;
@@ -8,24 +7,19 @@ using Wox.Infrastructure.Logger;
namespace Wox.Plugin.Program.ProgramSources
{
[Serializable]
- [Browsable(false)]
- public class AppPathsProgramSource : AbstractProgramSource
+ public class AppPathsProgramSource : ProgramSource
{
public AppPathsProgramSource()
{
BonusPoints = -10;
}
- public AppPathsProgramSource(ProgramSource source) : this()
- {
- BonusPoints = source.BonusPoints;
- }
-
public override List LoadPrograms()
{
var list = new List();
ReadAppPaths(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", list);
- ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list); //TODO: need test more on 64-bit
+ ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list);
+ //TODO: need test more on 64-bit
return list;
}
@@ -40,12 +34,12 @@ namespace Wox.Plugin.Program.ProgramSources
{
using (var key = root.OpenSubKey(item))
{
- string path = key.GetValue("") as string;
+ var path = key.GetValue("") as string;
if (string.IsNullOrEmpty(path)) continue;
// fix path like this ""\"C:\\folder\\executable.exe\"""
const int begin = 0;
- int end = path.Length - 1;
+ var end = path.Length - 1;
const char quotationMark = '"';
if (path[begin] == quotationMark && path[end] == quotationMark)
{
@@ -66,10 +60,5 @@ namespace Wox.Plugin.Program.ProgramSources
}
}
}
-
- public override string ToString()
- {
- return typeof(AppPathsProgramSource).Name;
- }
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs
index 2eee434c96..185330be62 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs
@@ -1,40 +1,30 @@
using System;
-using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
namespace Wox.Plugin.Program.ProgramSources
{
[Serializable]
- [Browsable(false)]
- public class CommonStartMenuProgramSource : FileSystemProgramSource
+ public sealed class CommonStartMenuProgramSource : FileSystemProgramSource
{
+ private const int CSIDL_COMMON_PROGRAMS = 0x17;
+
+ // todo happlebao how to pass location before loadPrograms
+ public CommonStartMenuProgramSource()
+ {
+ Location = getPath();
+ }
+
[DllImport("shell32.dll")]
- static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate);
- const int CSIDL_COMMON_PROGRAMS = 0x17;
+ private static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder,
+ bool fCreate);
private static string getPath()
{
- StringBuilder commonStartMenuPath = new StringBuilder(560);
+ var commonStartMenuPath = new StringBuilder(560);
SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false);
return commonStartMenuPath.ToString();
}
-
- public CommonStartMenuProgramSource(string[] suffixes)
- : base(getPath(), suffixes)
- {
- }
-
- public CommonStartMenuProgramSource(ProgramSource source)
- : this(source.Suffixes)
- {
- BonusPoints = source.BonusPoints;
- }
-
- public override string ToString()
- {
- return typeof(CommonStartMenuProgramSource).Name;
- }
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs
index 420d6172a3..718aafd7cc 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs
@@ -8,35 +8,17 @@ using Wox.Infrastructure.Logger;
namespace Wox.Plugin.Program.ProgramSources
{
[Serializable]
- public class FileSystemProgramSource : AbstractProgramSource
+ public class FileSystemProgramSource : ProgramSource
{
- private string _baseDirectory;
- private int _maxDepth;
- private string[] _suffixes;
-
- public FileSystemProgramSource(string baseDirectory, int maxDepth, string[] suffixes)
- {
- _baseDirectory = baseDirectory;
- _maxDepth = maxDepth;
- _suffixes = suffixes;
- }
-
- public FileSystemProgramSource(string baseDirectory, string[] suffixes)
- : this(baseDirectory, -1, suffixes) {}
-
- public FileSystemProgramSource(ProgramSource source)
- : this(source.Location, source.MaxDepth, source.Suffixes)
- {
- BonusPoints = source.BonusPoints;
- }
+ public string Location { get; set; } = "";
public override List LoadPrograms()
{
- List list = new List();
- if (Directory.Exists(_baseDirectory))
+ var list = new List();
+ if (Directory.Exists(Location))
{
- GetAppFromDirectory(_baseDirectory, list);
- FileChangeWatcher.AddWatch(_baseDirectory, _suffixes);
+ GetAppFromDirectory(Location, list);
+ FileChangeWatcher.AddWatch(Location, Suffixes);
}
return list;
}
@@ -48,17 +30,17 @@ namespace Wox.Plugin.Program.ProgramSources
private void GetAppFromDirectory(string path, List list, int depth)
{
- if(_maxDepth != -1 && depth > _maxDepth)
+ if (MaxDepth != -1 && depth > MaxDepth)
{
return;
}
try
{
- foreach (string file in Directory.GetFiles(path))
+ foreach (var file in Directory.GetFiles(path))
{
- if (_suffixes.Any(o => file.EndsWith("." + o)))
+ if (Suffixes.Any(o => file.EndsWith("." + o)))
{
- Program p = CreateEntry(file);
+ var p = CreateEntry(file);
p.Source = this;
list.Add(p);
}
@@ -75,10 +57,10 @@ namespace Wox.Plugin.Program.ProgramSources
Log.Exception(woxPluginException);
}
}
-
public override string ToString()
{
- return typeof(FileSystemProgramSource).Name + ":" + _baseDirectory;
+ var display = GetType().Name + Location;
+ return display;
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/IProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs
similarity index 62%
rename from Plugins/Wox.Plugin.Program/IProgramSource.cs
rename to Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs
index 6df37995c9..9e4e839e32 100644
--- a/Plugins/Wox.Plugin.Program/IProgramSource.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs
@@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-namespace Wox.Plugin.Program
+namespace Wox.Plugin.Program.ProgramSources
{
- public interface IProgramSource
- {
- List LoadPrograms();
- int BonusPoints { get; set; }
- }
-
[Serializable]
- public abstract class AbstractProgramSource : IProgramSource
+ public abstract class ProgramSource
{
- public abstract List LoadPrograms();
+ public const char SuffixSeperator = ';';
+
+ public int BonusPoints { get; set; } = 0;
+ public bool Enabled { get; set; } = true;
+ // happlebao todo: temp hack for program suffixes
+ public string[] Suffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
+ public int MaxDepth { get; set; } = -1;
- public int BonusPoints { get; set; }
+ public abstract List LoadPrograms();
protected Program CreateEntry(string file)
{
@@ -34,16 +34,18 @@ namespace Wox.Plugin.Program
p.ExecutableName = Path.GetFileName(file);
try
{
- FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(file);
+ var versionInfo = FileVersionInfo.GetVersionInfo(file);
if (!string.IsNullOrEmpty(versionInfo.FileDescription))
{
p.Title = versionInfo.FileDescription;
}
}
- catch (Exception) { }
+ catch (Exception)
+ {
+ }
break;
}
return p;
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs
index 97acba337f..d6489c0f45 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs
@@ -1,26 +1,14 @@
using System;
-using System.ComponentModel;
namespace Wox.Plugin.Program.ProgramSources
{
+
[Serializable]
- [Browsable(false)]
- public class UserStartMenuProgramSource : FileSystemProgramSource
+ public sealed class UserStartMenuProgramSource : FileSystemProgramSource
{
- public UserStartMenuProgramSource(string[] suffixes)
- : base(Environment.GetFolderPath(Environment.SpecialFolder.Programs), suffixes)
+ public UserStartMenuProgramSource()
{
- }
-
- public UserStartMenuProgramSource(ProgramSource source)
- : this(source.Suffixes)
- {
- BonusPoints = source.BonusPoints;
- }
-
- public override string ToString()
- {
- return typeof(UserStartMenuProgramSource).Name;
+ Location = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs
index 390e16d164..e484ba55ab 100644
--- a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs
+++ b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs
@@ -1,5 +1,6 @@
using System.Windows;
using System.Linq;
+using Wox.Plugin.Program.ProgramSources;
namespace Wox.Plugin.Program
{
diff --git a/Plugins/Wox.Plugin.Program/Settings.cs b/Plugins/Wox.Plugin.Program/Settings.cs
index 9acd01d727..6fc052247c 100644
--- a/Plugins/Wox.Plugin.Program/Settings.cs
+++ b/Plugins/Wox.Plugin.Program/Settings.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
+using Wox.Plugin.Program.ProgramSources;
namespace Wox.Plugin.Program
{
public class Settings
{
- public List ProgramSources { get; set; } = new List();
+ public List ProgramSources { get; set; } = new List();
public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
public bool EnableStartMenuSource { get; set; } = true;
diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
index cbc3820a35..874d0b5b48 100644
--- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
+++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
@@ -61,7 +61,6 @@
AddProgramSource.xaml
-
@@ -69,7 +68,7 @@
ProgramSetting.xaml
-
+
diff --git a/Plugins/Wox.Plugin.Shell/Main.cs b/Plugins/Wox.Plugin.Shell/Main.cs
index 1504b0befd..360ba508b9 100644
--- a/Plugins/Wox.Plugin.Shell/Main.cs
+++ b/Plugins/Wox.Plugin.Shell/Main.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Windows;
using WindowsInput;
+using WindowsInput.Native;
using Wox.Infrastructure.Hotkey;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.Storage;
@@ -12,19 +13,19 @@ using Application = System.Windows.Application;
using Control = System.Windows.Controls.Control;
using Keys = System.Windows.Forms.Keys;
-namespace Wox.Plugin.CMD
+namespace Wox.Plugin.Shell
{
- public class CMD : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
+ public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
{
private const string Image = "Images/shell.png";
- private PluginInitContext context;
- private bool WinRStroked;
- private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator());
+ private PluginInitContext _context;
+ private bool _winRStroked;
+ private readonly KeyboardSimulator _keyboardSimulator = new KeyboardSimulator(new InputSimulator());
private readonly Settings _settings;
private readonly PluginJsonStorage _storage;
- public CMD()
+ public Main()
{
_storage = new PluginJsonStorage();
_settings = _storage.Load();
@@ -104,14 +105,14 @@ namespace Wox.Plugin.CMD
{
if (m.Key == cmd)
{
- result.SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value);
+ result.SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value);
return null;
}
var ret = new Result
{
Title = m.Key,
- SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
+ SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
IcoPath = Image,
Action = c =>
{
@@ -130,7 +131,7 @@ namespace Wox.Plugin.CMD
{
Title = cmd,
Score = 5000,
- SubTitle = context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"),
+ SubTitle = _context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"),
IcoPath = Image,
Action = c =>
{
@@ -148,7 +149,7 @@ namespace Wox.Plugin.CMD
.Select(m => new Result
{
Title = m.Key,
- SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
+ SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
IcoPath = Image,
Action = c =>
{
@@ -165,7 +166,7 @@ namespace Wox.Plugin.CMD
command = Environment.ExpandEnvironmentVariables(command);
ProcessStartInfo info;
- if (_settings.Shell == Shell.CMD)
+ if (_settings.Shell == Shell.Cmd)
{
var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause";
info = new ProcessStartInfo
@@ -268,7 +269,7 @@ namespace Wox.Plugin.CMD
public void Init(PluginInitContext context)
{
- this.context = context;
+ this._context = context;
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
}
@@ -278,13 +279,14 @@ namespace Wox.Plugin.CMD
{
if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed)
{
- WinRStroked = true;
+ _winRStroked = true;
OnWinRPressed();
return false;
}
- if (keyevent == (int)KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin)
+ if (keyevent == (int)KeyEvent.WM_KEYUP && _winRStroked && vkcode == (int)Keys.LWin)
{
- WinRStroked = false;
+ _winRStroked = false;
+ _keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL);
return false;
}
}
@@ -293,7 +295,7 @@ namespace Wox.Plugin.CMD
private void OnWinRPressed()
{
- context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}");
+ _context.API.ChangeQuery($"{_context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}");
Application.Current.MainWindow.Visibility = Visibility.Visible;
}
@@ -304,12 +306,12 @@ namespace Wox.Plugin.CMD
public string GetTranslatedPluginTitle()
{
- return context.API.GetTranslation("wox_plugin_cmd_plugin_name");
+ return _context.API.GetTranslation("wox_plugin_cmd_plugin_name");
}
public string GetTranslatedPluginDescription()
{
- return context.API.GetTranslation("wox_plugin_cmd_plugin_description");
+ return _context.API.GetTranslation("wox_plugin_cmd_plugin_description");
}
public List LoadContextMenus(Result selectedResult)
@@ -318,7 +320,7 @@ namespace Wox.Plugin.CMD
{
new Result
{
- Title = context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"),
+ Title = _context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"),
Action = c =>
{
Execute(selectedResult.Title, true);
diff --git a/Plugins/Wox.Plugin.Shell/Settings.cs b/Plugins/Wox.Plugin.Shell/Settings.cs
index 2734097395..62eb31f4e3 100644
--- a/Plugins/Wox.Plugin.Shell/Settings.cs
+++ b/Plugins/Wox.Plugin.Shell/Settings.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
-namespace Wox.Plugin.CMD
+namespace Wox.Plugin.Shell
{
public class Settings
{
- public Shell Shell { get; set; } = Shell.CMD;
+ public Shell Shell { get; set; } = Shell.Cmd;
public bool ReplaceWinR { get; set; } = true;
public bool LeaveShellOpen { get; set; }
public Dictionary Count = new Dictionary();
@@ -24,7 +24,7 @@ namespace Wox.Plugin.CMD
public enum Shell
{
- CMD = 0,
+ Cmd = 0,
Powershell = 1,
RunCommand = 2,
diff --git a/Plugins/Wox.Plugin.Shell/ShellSetting.xaml b/Plugins/Wox.Plugin.Shell/ShellSetting.xaml
index a0d4ae7d96..f631f6e228 100644
--- a/Plugins/Wox.Plugin.Shell/ShellSetting.xaml
+++ b/Plugins/Wox.Plugin.Shell/ShellSetting.xaml
@@ -1,4 +1,4 @@
-();
}
}
+ Constant.PythonPath = filename;
var plugins = metadatas.Select(metadata => new PluginPair
{
Plugin = new PythonPlugin(filename),
diff --git a/Wox.Core/Resource/Theme.cs b/Wox.Core/Resource/Theme.cs
index 391456d2c7..68df370b1f 100644
--- a/Wox.Core/Resource/Theme.cs
+++ b/Wox.Core/Resource/Theme.cs
@@ -59,7 +59,7 @@ namespace Wox.Core.Resource
// Exception of FindResource can't be cathed if global exception handle is set
var isBlur = Application.Current.TryFindResource("ThemeBlurEnabled");
- if (isBlur is bool)
+ if (isBlur is bool && Environment.OSVersion.Version >= new Version(6, 2))
{
SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur);
}
diff --git a/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/Wox.Infrastructure/Exception/ExceptionFormatter.cs
index 31f548ae8d..91fc5f2f4b 100644
--- a/Wox.Infrastructure/Exception/ExceptionFormatter.cs
+++ b/Wox.Infrastructure/Exception/ExceptionFormatter.cs
@@ -24,54 +24,52 @@ namespace Wox.Infrastructure.Exception
sb.AppendLine();
sb.AppendLine("```");
- var exlist = new List();
+ var exlist = new List();
- while (ex != null)
+ while (ex != null)
+ {
+ var exsb = new StringBuilder();
+ exsb.Append(ex.GetType().FullName);
+ exsb.Append(": ");
+ exsb.AppendLine(ex.Message);
+ if (ex.Source != null)
{
- var exsb = new StringBuilder();
- exsb.Append(ex.GetType().FullName);
- exsb.Append(": ");
- exsb.AppendLine(ex.Message);
- if (ex.Source != null)
- {
- exsb.Append(" Source: ");
- exsb.AppendLine(ex.Source);
- }
- if (ex.TargetSite != null)
- {
- exsb.Append(" TargetAssembly: ");
- exsb.AppendLine(ex.TargetSite.Module.Assembly.ToString());
- exsb.Append(" TargetModule: ");
- exsb.AppendLine(ex.TargetSite.Module.ToString());
- exsb.Append(" TargetSite: ");
- exsb.AppendLine(ex.TargetSite.ToString());
- }
- exsb.AppendLine(ex.StackTrace);
- exlist.Add(exsb);
-
- ex = ex.InnerException;
+ exsb.Append(" Source: ");
+ exsb.AppendLine(ex.Source);
}
-
- foreach (var result in exlist.Select(o => o.ToString()).Reverse())
+ if (ex.TargetSite != null)
{
- sb.AppendLine(result);
+ exsb.Append(" TargetAssembly: ");
+ exsb.AppendLine(ex.TargetSite.Module.Assembly.ToString());
+ exsb.Append(" TargetModule: ");
+ exsb.AppendLine(ex.TargetSite.Module.ToString());
+ exsb.Append(" TargetSite: ");
+ exsb.AppendLine(ex.TargetSite.ToString());
}
- sb.AppendLine("```");
- sb.AppendLine();
+ exsb.AppendLine(ex.StackTrace);
+ exlist.Add(exsb);
+
+ ex = ex.InnerException;
+ }
+
+ foreach (var result in exlist.Select(o => o.ToString()).Reverse())
+ {
+ sb.AppendLine(result);
+ }
+ sb.AppendLine("```");
+ sb.AppendLine();
sb.AppendLine("## Environment");
- sb.AppendLine();
- sb.Append("* Command Line: ");
- sb.AppendLine(Environment.CommandLine);
- sb.Append("* Timestamp: ");
- sb.AppendLine(DateTime.Now.ToString(CultureInfo.InvariantCulture));
- sb.Append("* IntPtr Length: ");
- sb.AppendLine(IntPtr.Size.ToString());
- sb.Append("* System Version: ");
- sb.AppendLine(Environment.OSVersion.VersionString);
- sb.Append("* CLR Version: ");
- sb.AppendLine(Environment.Version.ToString());
- sb.AppendLine("* Installed .NET Framework: ");
+ sb.AppendLine($"* Command Line: {Environment.CommandLine}");
+ sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
+ sb.AppendLine($"* Wox version: {Constant.Version}");
+ sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
+ sb.AppendLine($"* IntPtr Length: {IntPtr.Size}");
+ sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}");
+ sb.AppendLine($"* Python Path: {Constant.PythonPath}");
+ sb.AppendLine($"* Everything SDK Path: {Constant.EverythingSDKPath}");
+ sb.AppendLine($"* CLR Version: {Environment.Version}");
+ sb.AppendLine($"* Installed .NET Framework: ");
foreach (var result in GetFrameworkVersionFromRegistry())
{
sb.Append(" * ");
diff --git a/Wox.Infrastructure/Wox.cs b/Wox.Infrastructure/Wox.cs
index 4e73c94703..39f2fe6229 100644
--- a/Wox.Infrastructure/Wox.cs
+++ b/Wox.Infrastructure/Wox.cs
@@ -21,5 +21,8 @@ namespace Wox.Infrastructure
public const string Github = "https://github.com/Wox-launcher/Wox";
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location).ProductVersion;
+
+ public static string PythonPath;
+ public static string EverythingSDKPath;
}
}
diff --git a/Wox.sln b/Wox.sln
index f582107628..5cb8e57632 100644
--- a/Wox.sln
+++ b/Wox.sln
@@ -70,9 +70,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Calculator", "Plugins\Wox.Plugin.Calculator\Wox.Plugin.Calculator.csproj", "{59BD9891-3837-438A-958D-ADC7F91F6F7E}"
EndProject
Global
- GlobalSection(Performance) = preSolution
- HasPerformanceSessions = true
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs
index 77bade7005..4a17a2fe1e 100644
--- a/Wox/App.xaml.cs
+++ b/Wox/App.xaml.cs
@@ -60,10 +60,7 @@ namespace Wox
AutoStartup();
AutoUpdates();
- if (!_settings.HideOnStartup)
- {
- mainVM.MainWindowVisibility = Visibility.Visible;
- }
+ mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible;
});
}
@@ -102,7 +99,7 @@ namespace Wox
}
///
- /// let exception throw as normal is better for Debug
+ /// let exception throw as normal is better for Debug
///
[Conditional("RELEASE")]
private void RegisterDispatcherUnhandledException()
@@ -113,7 +110,7 @@ namespace Wox
///
- /// let exception throw as normal is better for Debug
+ /// let exception throw as normal is better for Debug
///
[Conditional("RELEASE")]
private static void RegisterAppDomainExceptions()
diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml
index 3412cd0ac3..5106b8b9bb 100644
--- a/Wox/MainWindow.xaml
+++ b/Wox/MainWindow.xaml
@@ -17,6 +17,7 @@
Icon="Images\app.png"
AllowsTransparency="True"
Loaded="OnLoaded"
+ Initialized="OnInitialized"
Closing="OnClosing"
Drop="OnDrop"
SizeChanged="OnSizeChanged"
diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs
index 1a130c71ba..0110e87339 100644
--- a/Wox/MainWindow.xaml.cs
+++ b/Wox/MainWindow.xaml.cs
@@ -46,11 +46,16 @@ namespace Wox
_viewModel.Save();
}
+ private void OnInitialized(object sender, EventArgs e)
+ {
+ // show notify icon when wox is hided
+ InitializeNotifyIcon();
+ }
+
private void OnLoaded(object sender, RoutedEventArgs _)
{
WindowIntelopHelper.DisableControlBox(this);
ThemeManager.Instance.ChangeTheme(_settings.Theme);
- InitializeNotifyIcon();
InitProgressbarAnimation();
_viewModel.PropertyChanged += (o, e) =>
@@ -230,7 +235,11 @@ namespace Wox
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
- QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
+ if (_viewModel.QueryTextCursorMovedToEnd)
+ {
+ QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
+ _viewModel.QueryTextCursorMovedToEnd = false;
+ }
}
}
}
\ No newline at end of file
diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs
index e9801f686c..86f415727e 100644
--- a/Wox/PublicAPIInstance.cs
+++ b/Wox/PublicAPIInstance.cs
@@ -36,12 +36,12 @@ namespace Wox
public void ChangeQuery(string query, bool requery = false)
{
- _mainVM.QueryText = query;
+ _mainVM.ChangeQueryText(query);
}
public void ChangeQueryText(string query, bool selectAll = false)
{
- _mainVM.QueryText = query;
+ _mainVM.ChangeQueryText(query);
}
[Obsolete]
diff --git a/Wox/ReportWindow.xaml.cs b/Wox/ReportWindow.xaml.cs
index 6a365e46c8..93fbb08cb7 100644
--- a/Wox/ReportWindow.xaml.cs
+++ b/Wox/ReportWindow.xaml.cs
@@ -34,6 +34,10 @@ namespace Wox
StringBuilder content = new StringBuilder();
content.AppendLine($"Wox version: {Constant.Version}");
content.AppendLine($"OS Version: {Environment.OSVersion.VersionString}");
+ content.AppendLine($"IntPtr Length: {IntPtr.Size}");
+ content.AppendLine($"x64: {Environment.Is64BitOperatingSystem}");
+ content.AppendLine($"Python Path: {Constant.PythonPath}");
+ content.AppendLine($"Everything SDK Path: {Constant.EverythingSDKPath}");
content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
content.AppendLine("Exception:");
content.AppendLine(exception.Source);
diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs
index d5fa307f69..8cc43084c8 100644
--- a/Wox/ViewModel/MainViewModel.cs
+++ b/Wox/ViewModel/MainViewModel.cs
@@ -205,7 +205,19 @@ namespace Wox.ViewModel
Query();
}
}
+
+ ///
+ /// we need move cursor to end when we manually changed query
+ /// but we don't want to move cursor to end when query is updated from TextBox
+ ///
+ ///
+ public void ChangeQueryText(string queryText)
+ {
+ QueryTextCursorMovedToEnd = true;
+ QueryText = queryText;
+ }
public bool QueryTextSelected { get; set; }
+ public bool QueryTextCursorMovedToEnd { get; set; }
private ResultsViewModel _selectedResults;
private ResultsViewModel SelectedResults
@@ -218,7 +230,7 @@ namespace Wox.ViewModel
{
ContextMenu.Visbility = Visibility.Collapsed;
History.Visbility = Visibility.Collapsed;
- QueryText = _queryTextBeforeLeaveResults;
+ ChangeQueryText(_queryTextBeforeLeaveResults);
}
else
{
@@ -325,7 +337,7 @@ namespace Wox.ViewModel
Action = _ =>
{
SelectedResults = Results;
- QueryText = h.Query;
+ ChangeQueryText(h.Query);
return false;
}
};
@@ -547,7 +559,7 @@ namespace Wox.ViewModel
{
if (ShouldIgnoreHotkeys()) return;
MainWindowVisibility = Visibility.Visible;
- QueryText = hotkey.ActionKeyword;
+ ChangeQueryText(hotkey.ActionKeyword);
});
}
}