From f389b1ae93bdd83ac9c3a590994a1843a3824da1 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Sat, 11 Jan 2014 18:23:59 +0800 Subject: [PATCH] Fix issue#13 --- WinAlfred/MainWindow.xaml.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/WinAlfred/MainWindow.xaml.cs b/WinAlfred/MainWindow.xaml.cs index 35fd1f299..b612f9365 100644 --- a/WinAlfred/MainWindow.xaml.cs +++ b/WinAlfred/MainWindow.xaml.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media.Animation; using System.Windows.Shapes; +using System.Windows.Threading; using IWshRuntimeLibrary; using Microsoft.Win32; using WinAlfred.Commands; @@ -140,15 +141,9 @@ namespace WinAlfred private void ShowWinAlfred() { Show(); - //FocusManager.SetFocusedElement(this, tbQuery); - tbQuery.Focusable = true; - Keyboard.Focus(tbQuery); + Activate(); + tbQuery.Focus(); tbQuery.SelectAll(); - - if (!tbQuery.IsKeyboardFocused) - { - MessageBox.Show("didnt focus"); - } } private void SetAutoStart(bool IsAtuoRun) @@ -177,6 +172,7 @@ namespace WinAlfred InitialTray(); selectedRecords.LoadSelectedRecords(); SetAutoStart(true); + ShowWinAlfred(); //var engine = new Jurassic.ScriptEngine(); //MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString()); }