From 729640d6ec831906ba5744f3a75ceb89d7b89858 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 11 Feb 2014 20:53:41 +0800 Subject: [PATCH 1/9] Init --- Wox/MainWindow.xaml.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index caec78359f..6ea5410519 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -31,7 +31,6 @@ namespace Wox private KeyboardListener keyboardListener = new KeyboardListener(); private bool WinRStroked = false; - private WindowsInput.KeyboardSimulator keyboardSimulator = new WindowsInput.KeyboardSimulator(new WindowsInput.InputSimulator()); public MainWindow() From 4736921d056260407478e6692fed4d69ff98412e Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Wed, 19 Feb 2014 22:50:15 +0800 Subject: [PATCH 2/9] Replace ResultItem usercontrol with listbox to improve ui performance --- Wox/ImagePathConverter.cs | 53 +++++++++++ Wox/MainWindow.xaml.cs | 8 +- Wox/ResultPanel.xaml | 46 ++++++++- Wox/ResultPanel.xaml.cs | 194 +++++++++----------------------------- Wox/Wox.csproj | 1 + 5 files changed, 142 insertions(+), 160 deletions(-) create mode 100644 Wox/ImagePathConverter.cs diff --git a/Wox/ImagePathConverter.cs b/Wox/ImagePathConverter.cs new file mode 100644 index 0000000000..8f988d8a56 --- /dev/null +++ b/Wox/ImagePathConverter.cs @@ -0,0 +1,53 @@ +using System; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace Wox +{ + public class ImagePathConverter : IMultiValueConverter + { + private static ImageSource GetIcon(string fileName) + { + Icon icon = Icon.ExtractAssociatedIcon(fileName); + return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( + icon.Handle, + new Int32Rect(0, 0, icon.Width, icon.Height), + BitmapSizeOptions.FromEmptyOptions()); + } + + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + string path = values[0].ToString(); + string pluginDirectory = values[1].ToString(); + + string resolvedPath = string.Empty; + if (!string.IsNullOrEmpty(path) && path.Contains(":\\") && File.Exists(path)) + { + resolvedPath = path; + } + else if (!string.IsNullOrEmpty(path) && File.Exists(pluginDirectory + path)) + { + resolvedPath = pluginDirectory + path; + } + + if (resolvedPath.ToLower().EndsWith(".exe") || resolvedPath.ToLower().EndsWith(".lnk")) + { + return GetIcon(resolvedPath); + } + else + { + return new BitmapImage(new Uri(resolvedPath)); + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } + } +} \ No newline at end of file diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 6ea5410519..bd3702c066 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -40,7 +40,6 @@ namespace Wox InitialTray(); hook.KeyPressed += OnHotKey; hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space); - resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent; ThreadPool.SetMaxThreads(30, 10); InitProgressbarAnimation(); try @@ -106,11 +105,6 @@ namespace Wox notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(childen); } - private void resultCtrl_resultItemChangedEvent() - { - resultCtrl.Margin = resultCtrl.GetCurrentResultCount() > 0 ? new Thickness { Top = grid.Margin.Top } : new Thickness { Top = 0 }; - } - private void OnHotKey(object sender, KeyPressedEventArgs e) { if (!IsVisible) @@ -301,8 +295,10 @@ namespace Wox }); resultCtrl.Dispatcher.Invoke(new Action(() => { + var t1 = Environment.TickCount; List l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList(); resultCtrl.AddResults(l); + Debug.WriteLine("Time:" + (Environment.TickCount - t1) + " Count:" + l.Count); })); } } diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index c5efe75d31..42806e17d4 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -3,9 +3,49 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:wox="clr-namespace:Wox" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 118f8923e8..10896ccf7f 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; -using System.Linq; -using System.Windows; +using System.Diagnostics; using System.Windows.Controls; using Wox.Helper; using Wox.Plugin; +using Point = System.Windows.Point; namespace Wox { @@ -11,70 +11,37 @@ namespace Wox { public bool Dirty { get; set; } - public delegate void ResultItemsChanged(); - - public event ResultItemsChanged resultItemChangedEvent; - - protected virtual void OnResultItemChangedEvent() - { - ResultItemsChanged handler = resultItemChangedEvent; - if (handler != null) handler(); - } - public void AddResults(List results) { - if (results.Count == 0) return; - if (Dirty) { Dirty = false; - pnlContainer.Children.Clear(); + lbResults.Items.Clear(); } - - for (int i = 0; i < results.Count; i++) + foreach (var result in results) { - Result result = results[i]; - if (!CheckExisted(result)) - { - ResultItem control = new ResultItem(result); - pnlContainer.Children.Insert(GetInsertLocation(result.Score), control); - } + int position = GetInsertLocation(result.Score); + lbResults.Items.Insert(position, result); } - + lbResults.UpdateLayout(); SelectFirst(); - pnlContainer.UpdateLayout(); - - double resultItemHeight = 0; - if (pnlContainer.Children.Count > 0) - { - var resultItem = pnlContainer.Children[0] as ResultItem; - if (resultItem != null) - resultItemHeight = resultItem.ActualHeight; - } - pnlContainer.Height = pnlContainer.Children.Count * resultItemHeight; - OnResultItemChangedEvent(); - } - - private bool CheckExisted(Result result) - { - return pnlContainer.Children.Cast().Any(child => child.Result.Equals(result)); } private int GetInsertLocation(int currentScore) { - int location = pnlContainer.Children.Count; - if (pnlContainer.Children.Count == 0) return 0; - if (currentScore > ((ResultItem)pnlContainer.Children[0]).Result.Score) return 0; + int location = lbResults.Items.Count; + if (lbResults.Items.Count == 0) return 0; + if (currentScore > ((Result)lbResults.Items[0]).Score) return 0; - for (int index = 1; index < pnlContainer.Children.Count; index++) + for (int index = 1; index < lbResults.Items.Count; index++) { - ResultItem next = pnlContainer.Children[index] as ResultItem; - ResultItem prev = pnlContainer.Children[index - 1] as ResultItem; + Result next = lbResults.Items[index] as Result; + Result prev = lbResults.Items[index - 1] as Result; if (next != null && prev != null) { - if ((currentScore >= next.Result.Score && currentScore <= prev.Result.Score)) + if ((currentScore >= next.Score && currentScore <= prev.Score)) { - if (currentScore == next.Result.Score) + if (currentScore == next.Score) { location = index + 1; } @@ -89,40 +56,10 @@ namespace Wox return location; } - public int GetCurrentResultCount() - { - return pnlContainer.Children.Count; - } - - public int GetCurrentSelectedResultIndex() - { - for (int i = 0; i < pnlContainer.Children.Count; i++) - { - var resultItemControl = pnlContainer.Children[i] as ResultItem; - if (resultItemControl != null && resultItemControl.Selected) - { - return i; - } - } - return -1; - } - - public void UnSelectAll() - { - for (int i = 0; i < pnlContainer.Children.Count; i++) - { - var resultItemControl = pnlContainer.Children[i] as ResultItem; - if (resultItemControl != null && resultItemControl.Selected) - { - resultItemControl.Selected = false; - } - } - } - public void SelectNext() { - int index = GetCurrentSelectedResultIndex(); - if (index == pnlContainer.Children.Count - 1) + int index = lbResults.SelectedIndex; + if (index == lbResults.Items.Count - 1) { index = -1; } @@ -131,95 +68,44 @@ namespace Wox public void SelectPrev() { - int index = GetCurrentSelectedResultIndex(); + int index = lbResults.SelectedIndex; if (index == 0) { - index = pnlContainer.Children.Count; + index = lbResults.Items.Count; } Select(index - 1); } - private void Select(int index) - { - if (pnlContainer.Children.Count > 0) - { - int oldIndex = GetCurrentSelectedResultIndex(); - - UnSelectAll(); - var resultItemControl = pnlContainer.Children[index] as ResultItem; - if (resultItemControl != null) - { - resultItemControl.Selected = true; - - double scrollPosition = 0; - Point newItemBottomPoint = resultItemControl.TranslatePoint(new Point(0, resultItemControl.ActualHeight), pnlContainer); - scrollPosition = newItemBottomPoint.Y; - if (index == 0) - { - sv.ScrollToTop(); - return; - } - if (index == pnlContainer.Children.Count - 1) - { - sv.ScrollToBottom(); - return; - } - - if (index < oldIndex) - { - //move up and old item is at the top of the scroll view - var scrollPostionY = sv.VerticalOffset - sv.VerticalOffset%resultItemControl.ActualHeight + - resultItemControl.ActualHeight; - if (newItemBottomPoint.Y - scrollPostionY == 0) - { - scrollPosition = sv.VerticalOffset - resultItemControl.ActualHeight; - } - else - { - return; - } - } - else - { - //move down and old item is at the bottom of scroll view - double scrollPostionY = (sv.ActualHeight + sv.VerticalOffset) - (sv.ActualHeight + sv.VerticalOffset)%resultItemControl.ActualHeight; - if (scrollPostionY == newItemBottomPoint.Y - resultItemControl.ActualHeight) - { - scrollPosition = newItemBottomPoint.Y - sv.ActualHeight; - } - else - { - return; - } - } - - sv.ScrollToVerticalOffset(scrollPosition); - } - } - } - - public void SelectFirst() + private void SelectFirst() { Select(0); } + private void Select(int index) + { + if (index >= 0 && index < lbResults.Items.Count) + { + lbResults.SelectedItem = lbResults.Items.GetItemAt(index); + } + } + public Result AcceptSelect() { - int index = GetCurrentSelectedResultIndex(); + int index = lbResults.SelectedIndex; if (index < 0) return null; - var resultItemControl = pnlContainer.Children[index] as ResultItem; - if (resultItemControl != null) + var result = lbResults.Items[index] as Result; + if (result != null) { - if (resultItemControl.Result.Action != null) + if (result.Action != null) { - resultItemControl.Result.Action(new ActionContext() + result.Action(new ActionContext() { SpecialKeyState = new KeyboardListener().CheckModifiers() }); } - return resultItemControl.Result; + return result; } return null; @@ -232,9 +118,15 @@ namespace Wox public void Clear() { - pnlContainer.Children.Clear(); - pnlContainer.Height = 0; - OnResultItemChangedEvent(); + lbResults.Items.Clear(); + } + + private void lbResults_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (e.AddedItems.Count > 0) + { + lbResults.ScrollIntoView(e.AddedItems[0]); + } } } } \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 25fc11a8de..0580c2c3b2 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -125,6 +125,7 @@ + Msg.xaml From c425313ae61b749f025352547471a168361b1464 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Wed, 19 Feb 2014 23:42:21 +0800 Subject: [PATCH 3/9] Fix title aligment issue when subtitle is empty. --- Wox/ResultPanel.xaml | 6 ++--- Wox/StringNullOrEmptyToVisibilityConverter.cs | 26 +++++++++++++++++++ Wox/Wox.csproj | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Wox/StringNullOrEmptyToVisibilityConverter.cs diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index 42806e17d4..b68df11cf2 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -37,11 +37,11 @@ - - + + - + diff --git a/Wox/StringNullOrEmptyToVisibilityConverter.cs b/Wox/StringNullOrEmptyToVisibilityConverter.cs new file mode 100644 index 0000000000..8ed4b71c86 --- /dev/null +++ b/Wox/StringNullOrEmptyToVisibilityConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Wox +{ + public class StringNullOrEmptyToVisibilityConverter : MarkupExtension, IValueConverter + { + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 0580c2c3b2..8b6a91e461 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -144,6 +144,7 @@ SettingWindow.xaml + WebSearchSetting.xaml From 4e0ea5f9411d8b7ab82673cc8dc11c818604d6f4 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Thu, 20 Feb 2014 09:34:30 +0800 Subject: [PATCH 4/9] bug fix --- Wox/ImagePathConverter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Wox/ImagePathConverter.cs b/Wox/ImagePathConverter.cs index 8f988d8a56..2f7cb8154b 100644 --- a/Wox/ImagePathConverter.cs +++ b/Wox/ImagePathConverter.cs @@ -22,6 +22,8 @@ namespace Wox public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { + if (values[0] == null) return null; + string path = values[0].ToString(); string pluginDirectory = values[1].ToString(); From 5a3669cbe7c8c9f69e19db74306a44d9640cbead Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Thu, 20 Feb 2014 18:26:01 +0800 Subject: [PATCH 5/9] Bug fix --- Wox/ImagePathConverter.cs | 8 ++++---- Wox/ResultPanel.xaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Wox/ImagePathConverter.cs b/Wox/ImagePathConverter.cs index 2f7cb8154b..41d7543704 100644 --- a/Wox/ImagePathConverter.cs +++ b/Wox/ImagePathConverter.cs @@ -41,10 +41,10 @@ namespace Wox { return GetIcon(resolvedPath); } - else - { - return new BitmapImage(new Uri(resolvedPath)); - } + + if(!string.IsNullOrEmpty(path)) return new BitmapImage(new Uri(resolvedPath)); + + return null; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index b68df11cf2..70406144ec 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -11,7 +11,7 @@ - + From 18ee6ecf80f670c9bcd0801fdaeccde7ad9c0dfc Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Thu, 20 Feb 2014 21:46:23 +0800 Subject: [PATCH 6/9] fix some small UI issue --- Wox/MainWindow.xaml.cs | 28 ++++++----- Wox/ResultItem.xaml | 26 ---------- Wox/ResultItem.xaml.cs | 105 ---------------------------------------- Wox/ResultPanel.xaml | 8 +-- Wox/ResultPanel.xaml.cs | 5 +- Wox/Themes/Default.xaml | 26 +++++++--- Wox/Themes/Light.xaml | 35 ++++++++------ Wox/Wox.csproj | 7 --- 8 files changed, 63 insertions(+), 177 deletions(-) delete mode 100644 Wox/ResultItem.xaml delete mode 100644 Wox/ResultItem.xaml.cs diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index bd3702c066..01e0a65a2c 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -28,6 +28,8 @@ namespace Wox private NotifyIcon notifyIcon; Storyboard progressBarStoryboard = new Storyboard(); private bool queryHasReturn = false; + private static object locker = new object(); + private static List waitShowResultList = new List(); private KeyboardListener keyboardListener = new KeyboardListener(); private bool WinRStroked = false; @@ -51,12 +53,7 @@ namespace Wox SetTheme(CommonStorage.Instance.UserSetting.Theme = "Default"); } - this.Closing += MainWindow_Closing; - } - - void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) - { - e.Cancel = true; + Plugins.Init(); } private void WakeupApp() @@ -203,8 +200,7 @@ namespace Wox Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2; Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3; - WakeupApp(); - Plugins.Init(); + //WakeupApp(); keyboardListener.hookedKeyboardCallback += KListener_hookedKeyboardCallback; } @@ -293,13 +289,22 @@ namespace Wox { if (o.AutoAjustScore) o.Score += CommonStorage.Instance.UserSelectedRecords.GetSelectedCount(o); }); - resultCtrl.Dispatcher.Invoke(new Action(() => + lock(locker) + { + waitShowResultList.AddRange(list); + } + Dispatcher.DelayInvoke("ShowResult", k => resultCtrl.Dispatcher.Invoke(new Action(() => { var t1 = Environment.TickCount; - List l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList(); + + List l = waitShowResultList.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList(); + waitShowResultList.Clear(); + resultCtrl.AddResults(l); + Debug.WriteLine("Time:" + (Environment.TickCount - t1) + " Count:" + l.Count); - })); + })), TimeSpan.FromMilliseconds(50)); + } } @@ -327,6 +332,7 @@ namespace Wox public void CloseApp() { notifyIcon.Visible = false; + Close(); Environment.Exit(0); } diff --git a/Wox/ResultItem.xaml b/Wox/ResultItem.xaml deleted file mode 100644 index ea5b63db5b..0000000000 --- a/Wox/ResultItem.xaml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - Title - sub title - - - diff --git a/Wox/ResultItem.xaml.cs b/Wox/ResultItem.xaml.cs deleted file mode 100644 index 7671c70fc2..0000000000 --- a/Wox/ResultItem.xaml.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using Wox.Annotations; -using Wox.Helper; -using Wox.Infrastructure; -using Wox.Plugin; -using Brush = System.Windows.Media.Brush; - -namespace Wox -{ - public partial class ResultItem : UserControl, INotifyPropertyChanged - { - private bool selected; - - public Result Result { get; private set; } - - public bool Selected - { - get - { - return selected; - } - set - { - selected = value; - OnPropertyChanged("Selected"); - } - } - - public ResultItem(Result result) - { - InitializeComponent(); - Result = result; - - tbTitle.Text = result.Title; - tbSubTitle.Text = result.SubTitle; - if (string.IsNullOrEmpty(result.SubTitle)) - { - SubTitleRowDefinition.Height = new GridLength(0); - } - string path = string.Empty; - if (!string.IsNullOrEmpty(result.IcoPath) && result.IcoPath.Contains(":\\") && File.Exists(result.IcoPath)) - { - path = result.IcoPath; - } - else if (!string.IsNullOrEmpty(result.IcoPath) && File.Exists(result.PluginDirectory + result.IcoPath)) - { - path = result.PluginDirectory + result.IcoPath; - } - - if (!string.IsNullOrEmpty(path)) - { - if (path.ToLower().EndsWith(".exe") || path.ToLower().EndsWith(".lnk")) - { - imgIco.Source = GetIcon(path); - } - else - { - imgIco.Source = new BitmapImage(new Uri(path)); - } - } - - AddHandler(MouseLeftButtonUpEvent, new RoutedEventHandler((o, e) => - { - if (Result.Action != null) - Result.Action(new ActionContext() - { - SpecialKeyState = new KeyboardListener().CheckModifiers() - }); - - CommonStorage.Instance.UserSelectedRecords.Add(result); - if (!result.DontHideWoxAfterSelect) - { - App.Window.HideApp(); - } - e.Handled = true; - })); - } - - private static ImageSource GetIcon(string fileName) - { - Icon icon = Icon.ExtractAssociatedIcon(fileName); - return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( - icon.Handle, - new Int32Rect(0, 0, icon.Width, icon.Height), - BitmapSizeOptions.FromEmptyOptions()); - } - - public event PropertyChangedEventHandler PropertyChanged; - - [NotifyPropertyChangedInvocator] - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); - } - } -} diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index 70406144ec..3e0965699c 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -10,13 +10,13 @@ - - + + - + - + diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 10896ccf7f..10413e1648 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -1,9 +1,8 @@ using System.Collections.Generic; -using System.Diagnostics; +using System.Windows; using System.Windows.Controls; using Wox.Helper; using Wox.Plugin; -using Point = System.Windows.Point; namespace Wox { @@ -23,6 +22,7 @@ namespace Wox int position = GetInsertLocation(result.Score); lbResults.Items.Insert(position, result); } + gridContainer.Margin = lbResults.Items.Count > 0 ? new Thickness { Top = 8 } : new Thickness { Top = 0 }; lbResults.UpdateLayout(); SelectFirst(); } @@ -119,6 +119,7 @@ namespace Wox public void Clear() { lbResults.Items.Clear(); + gridContainer.Margin = new Thickness { Top = 0 }; } private void lbResults_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/Wox/Themes/Default.xaml b/Wox/Themes/Default.xaml index 33e17dd46f..b4f0546a4e 100644 --- a/Wox/Themes/Default.xaml +++ b/Wox/Themes/Default.xaml @@ -33,13 +33,25 @@ - diff --git a/Wox/Themes/Light.xaml b/Wox/Themes/Light.xaml index 3fc48c9873..31c6a7c2df 100644 --- a/Wox/Themes/Light.xaml +++ b/Wox/Themes/Light.xaml @@ -23,32 +23,37 @@ + #543BFD + + + diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 8b6a91e461..103976fc3f 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -138,9 +138,6 @@ ResultPanel.xaml - - ResultItem.xaml - SettingWindow.xaml @@ -168,10 +165,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile From a9123d2966e0adeea79ebcddc6d791a4ce936550 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Fri, 21 Feb 2014 18:59:47 +0800 Subject: [PATCH 7/9] UI changes. --- Wox/App.xaml | 39 +++++++++++++++++++++++++++++++++++++++ Wox/MainWindow.xaml.cs | 6 +++--- Wox/ResultPanel.xaml | 6 ++++++ Wox/ResultPanel.xaml.cs | 5 +++-- Wox/Themes/Default.xaml | 22 +++++++--------------- Wox/Themes/Light.xaml | 11 +++++++---- 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/Wox/App.xaml b/Wox/App.xaml index 4f0225e563..814c2d992a 100644 --- a/Wox/App.xaml +++ b/Wox/App.xaml @@ -7,6 +7,45 @@ + + + + + + + + + + + + + diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 01e0a65a2c..7da040573a 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -41,7 +41,7 @@ namespace Wox InitialTray(); hook.KeyPressed += OnHotKey; - hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space); + hook.RegisterHotKey(XModifierKeys.Win, Keys.W); ThreadPool.SetMaxThreads(30, 10); InitProgressbarAnimation(); try @@ -53,7 +53,6 @@ namespace Wox SetTheme(CommonStorage.Instance.UserSetting.Theme = "Default"); } - Plugins.Init(); } private void WakeupApp() @@ -201,6 +200,7 @@ namespace Wox Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3; //WakeupApp(); + Plugins.Init(); keyboardListener.hookedKeyboardCallback += KListener_hookedKeyboardCallback; } @@ -302,7 +302,7 @@ namespace Wox resultCtrl.AddResults(l); - Debug.WriteLine("Time:" + (Environment.TickCount - t1) + " Count:" + l.Count); + Debug.WriteLine("Total Time:" + (Environment.TickCount - t1) + " Count:" + l.Count); })), TimeSpan.FromMilliseconds(50)); } diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index 3e0965699c..ad039a449c 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -44,6 +44,12 @@ + + + + + + diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 10413e1648..14f61d3793 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics; using System.Windows; using System.Windows.Controls; using Wox.Helper; @@ -23,7 +25,6 @@ namespace Wox lbResults.Items.Insert(position, result); } gridContainer.Margin = lbResults.Items.Count > 0 ? new Thickness { Top = 8 } : new Thickness { Top = 0 }; - lbResults.UpdateLayout(); SelectFirst(); } diff --git a/Wox/Themes/Default.xaml b/Wox/Themes/Default.xaml index b4f0546a4e..27f6ed2427 100644 --- a/Wox/Themes/Default.xaml +++ b/Wox/Themes/Default.xaml @@ -1,16 +1,7 @@  - - - - + + #4F6180 - #543BFD - + + #543BFD - + \ No newline at end of file From 85515079d69f7b0502ecd80484dddd0d18ec56c7 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Fri, 21 Feb 2014 23:43:52 +0800 Subject: [PATCH 8/9] Fix theme bugs. --- Wox/App.xaml | 39 --------------------------------------- Wox/Themes/Default.xaml | 25 ++++++++++++++++++++----- Wox/Themes/Light.xaml | 2 ++ 3 files changed, 22 insertions(+), 44 deletions(-) diff --git a/Wox/App.xaml b/Wox/App.xaml index 814c2d992a..4f0225e563 100644 --- a/Wox/App.xaml +++ b/Wox/App.xaml @@ -7,45 +7,6 @@ - - - - - - - - - - - - - diff --git a/Wox/Themes/Default.xaml b/Wox/Themes/Default.xaml index 27f6ed2427..61447daf51 100644 --- a/Wox/Themes/Default.xaml +++ b/Wox/Themes/Default.xaml @@ -1,7 +1,16 @@  - - - - - #4F6180 diff --git a/Wox/Themes/Light.xaml b/Wox/Themes/Light.xaml index 8783a105ce..28c8f9f914 100644 --- a/Wox/Themes/Light.xaml +++ b/Wox/Themes/Light.xaml @@ -35,6 +35,8 @@