diff --git a/Wox.Infrastructure/UAC.cs b/Wox.Infrastructure/UAC.cs index 3f7fd707f6..2ee5aff981 100644 --- a/Wox.Infrastructure/UAC.cs +++ b/Wox.Infrastructure/UAC.cs @@ -55,7 +55,7 @@ namespace Wox.Infrastructure Debug.WriteLine(args); var psi = new ProcessStartInfo { - FileName = Path.Combine(Directory.GetCurrentDirectory(), "Wox.UAC.exe"), + FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Wox.UAC.exe"), Arguments = args, CreateNoWindow = true, Verb = "runas" diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 4c8710e91d..dcea10c2d3 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -67,7 +67,7 @@ namespace Wox base.OnStartup(e); window = new MainWindow(); - if (e.Args.Length == 0 || e.Args[0].ToLower() != "starthide") + if (e.Args.Length == 0 || e.Args[0].ToLower() != "hidestart") { window.ShowApp(); } @@ -77,7 +77,7 @@ namespace Wox public void Activate(string[] args) { - if (args.Length == 0 || args[0].ToLower() != "starthide") + if (args.Length == 0 || args[0].ToLower() != "hidestart") { window.ShowApp(); } diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index caec78359f..ce104b4ebf 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -10,6 +10,7 @@ using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media.Animation; +using System.Windows.Threading; using Wox.Commands; using Wox.Helper; using Wox.Infrastructure; @@ -31,6 +32,7 @@ namespace Wox private KeyboardListener keyboardListener = new KeyboardListener(); private bool WinRStroked = false; + private static object locker = new object(); private WindowsInput.KeyboardSimulator keyboardSimulator = new WindowsInput.KeyboardSimulator(new WindowsInput.InputSimulator()); @@ -198,7 +200,7 @@ namespace Wox } break; - case "starthide": + case "hidestart": HideApp(); break; } @@ -300,11 +302,14 @@ namespace Wox { if (o.AutoAjustScore) o.Score += CommonStorage.Instance.UserSelectedRecords.GetSelectedCount(o); }); - resultCtrl.Dispatcher.Invoke(new Action(() => + lock (locker) { - List l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList(); - resultCtrl.AddResults(l); - })); + resultCtrl.Dispatcher.Invoke(new Action(() => + { + List l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList(); + resultCtrl.AddResults(list); + })); + } } } diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 385a891dc3..f704e05924 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using System.Windows; @@ -149,7 +150,7 @@ namespace Wox { if (startup) { - rk.SetValue("Wox", Path.Combine(Directory.GetCurrentDirectory(), "Wox.exe startHide")); + rk.SetValue("Wox", Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Wox.exe hidestart")); } else { diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 25fc11a8de..4551a075e5 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -140,6 +140,9 @@ ResultItem.xaml + + ResultWindow.xaml + SettingWindow.xaml @@ -170,6 +173,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile