mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
Merge pull request #302 from kerams/max-results
Make the number of results shown at a time customizable
This commit is contained in:
commit
298e041b80
@ -103,6 +103,9 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
[JsonProperty]
|
||||
public string ProxyPassword { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public int MaxResultsToShow { get; set; }
|
||||
|
||||
public List<WebSearch> LoadDefaultWebSearches()
|
||||
{
|
||||
List<WebSearch> webSearches = new List<WebSearch>();
|
||||
@ -161,6 +164,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
OpacityMode = OpacityMode.Normal;
|
||||
LeaveCmdOpen = false;
|
||||
HideWhenDeactive = false;
|
||||
MaxResultsToShow = 6;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<UserControl x:Class="Wox.ResultPanel"
|
||||
x:Name="Results"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@ -6,8 +7,7 @@
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100">
|
||||
|
||||
<!-- set max height of listbox to allow 6 results showed at once -->
|
||||
<ListBox x:Name="lbResults" MaxHeight="300" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
||||
<ListBox x:Name="lbResults" MaxHeight="{Binding ElementName=Results, Path=MaxResultsToShow}" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
||||
<ListBox.Resources>
|
||||
<!--SelectedItem with focus-->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
|
||||
|
@ -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<Result> results)
|
||||
{
|
||||
|
||||
|
@ -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 @@
|
||||
<CheckBox x:Name="cbDontPromptUpdateMsg" Margin="10">
|
||||
Don't show upgrade msg if new version available
|
||||
</CheckBox>
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<ComboBox Name="comboMaxResultsToShow"/>
|
||||
<Label>Maximum number of results to show at a time</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Plugin">
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user