Fix "startup wox on window start" issue.

This commit is contained in:
qianlifeng 2014-02-18 22:02:55 +08:00
parent fcdb9e39c6
commit b8fbc837dc
5 changed files with 22 additions and 9 deletions

View file

@ -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"

View file

@ -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();
}

View file

@ -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<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList();
resultCtrl.AddResults(l);
}));
resultCtrl.Dispatcher.Invoke(new Action(() =>
{
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList();
resultCtrl.AddResults(list);
}));
}
}
}

View file

@ -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
{

View file

@ -140,6 +140,9 @@
<Compile Include="ResultItem.xaml.cs">
<DependentUpon>ResultItem.xaml</DependentUpon>
</Compile>
<Compile Include="ResultWindow.xaml.cs">
<DependentUpon>ResultWindow.xaml</DependentUpon>
</Compile>
<Compile Include="SettingWindow.xaml.cs">
<DependentUpon>SettingWindow.xaml</DependentUpon>
</Compile>
@ -170,6 +173,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ResultWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SettingWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>