diff --git a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs index 229e100a2a..1dc8a40f3c 100644 --- a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs +++ b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs @@ -103,6 +103,9 @@ namespace Wox.Infrastructure.Storage.UserSettings [JsonProperty] public string ProxyPassword { get; set; } + [JsonProperty] + public int MaxResultsToShow { get; set; } + public List LoadDefaultWebSearches() { List webSearches = new List(); @@ -161,6 +164,7 @@ namespace Wox.Infrastructure.Storage.UserSettings OpacityMode = OpacityMode.Normal; LeaveCmdOpen = false; HideWhenDeactive = false; + MaxResultsToShow = 6; return this; } diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index a156d6fc18..b5689b72a7 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -1,4 +1,5 @@  - - + diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 736d5d262c..22f33b515f 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -1,14 +1,10 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Media; -using Wox.Helper; +using Wox.Infrastructure.Storage.UserSettings; using Wox.Plugin; -using UserControl = System.Windows.Controls.UserControl; namespace Wox { @@ -31,6 +27,8 @@ namespace Wox public bool Dirty { get; set; } + public int MaxResultsToShow { get { return UserSettingStorage.Instance.MaxResultsToShow * 50; } } + public void AddResults(List results) { diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 1ab4866c0f..298e47a913 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -6,6 +6,7 @@ xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin" xmlns:system="clr-namespace:Wox.Plugin.SystemPlugins;assembly=Wox.Plugin.SystemPlugins" xmlns:converters="clr-namespace:Wox.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib" Icon="Images\app.png" Title="Wox Settings" ResizeMode="NoResize" @@ -31,6 +32,10 @@ Don't show upgrade msg if new version available + + + + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 4c752ad13c..eca8b7272b 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -66,10 +66,21 @@ namespace Wox UserSettingStorage.Instance.Save(); }; + comboMaxResultsToShow.SelectionChanged += (o, e) => + { + UserSettingStorage.Instance.MaxResultsToShow = (int)comboMaxResultsToShow.SelectedItem; + UserSettingStorage.Instance.Save(); + MainWindow.pnlResult.lbResults.GetBindingExpression(MaxHeightProperty).UpdateTarget(); + }; + cbStartWithWindows.IsChecked = File.Exists(woxLinkPath); cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive; cbDontPromptUpdateMsg.IsChecked = UserSettingStorage.Instance.DontPromptUpdateMsg; + comboMaxResultsToShow.ItemsSource = Enumerable.Range(2, 16); + var maxResults = UserSettingStorage.Instance.MaxResultsToShow; + comboMaxResultsToShow.SelectedItem = maxResults == 0 ? 6 : maxResults; + #endregion #region Theme