merge with master

This commit is contained in:
qianlifeng
2015-07-17 15:08:39 +08:00
25 changed files with 733 additions and 698 deletions

View File

@@ -5,6 +5,9 @@ using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using Wox.Infrastructure; using Wox.Infrastructure;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.Sys namespace Wox.Plugin.Sys
{ {
@@ -28,7 +31,7 @@ namespace Wox.Plugin.Sys
#endregion #endregion
public System.Windows.Controls.Control CreateSettingPanel() public Control CreateSettingPanel()
{ {
return new SysSettings(availableResults); return new SysSettings(availableResults);
} }
@@ -89,7 +92,15 @@ namespace Wox.Plugin.Sys
return true; return true;
} }
}, },
new Result new Result
{
Title = "Sleep",
SubTitle = "Put computer to sleep",
Score = 100,
IcoPath = "Images\\sleep.png",
Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false)
},
new Result
{ {
Title = "Exit", Title = "Exit",
SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"), SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),

View File

@@ -1,4 +1,4 @@
Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) <a href="https://chocolatey.org/packages/wox"><img src="https://img.shields.io/badge/chocolatey-wox-b4884f.svg?style=flat" style="height:auto; width: 100%"></a> [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised)&nbsp;[![Alipay](https://i.alipayobjects.com/i/localhost/png/201406/2m8C9z7xQ5_src.png)](http://meiweihezi.com/dashang/dashang.php?id=ZGsyNDI=)
========= =========
[Wox](http://www.getwox.com) is a launcher for windows, which was inspired by [Alfred](http://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). Wox provide an entry to search everything you want. [Wox](http://www.getwox.com) is a launcher for windows, which was inspired by [Alfred](http://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). Wox provide an entry to search everything you want.

View File

@@ -101,6 +101,9 @@ namespace Wox.Core.UserSettings
[JsonProperty] [JsonProperty]
public string ProxyPassword { get; set; } public string ProxyPassword { get; set; }
[JsonProperty]
public int MaxResultsToShow { get; set; }
protected override string ConfigFolder protected override string ConfigFolder
{ {
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); } get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
@@ -114,7 +117,7 @@ namespace Wox.Core.UserSettings
public void IncreaseActivateTimes() public void IncreaseActivateTimes()
{ {
ActivateTimes++; ActivateTimes++;
if (ActivateTimes % 15 == 0) if (ActivateTimes%15 == 0)
{ {
Save(); Save();
} }
@@ -135,6 +138,7 @@ namespace Wox.Core.UserSettings
HideWhenDeactive = false; HideWhenDeactive = false;
CustomPluginHotkeys = new List<CustomPluginHotkey>(); CustomPluginHotkeys = new List<CustomPluginHotkey>();
RememberLastLaunchLocation = false; RememberLastLaunchLocation = false;
MaxResultsToShow = 6;
return this; return this;
} }

BIN
Wox/Images/sleep.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,4 +1,5 @@
<UserControl x:Class="Wox.ResultPanel" <UserControl x:Class="Wox.ResultPanel"
x:Name="Results"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -6,8 +7,7 @@
xmlns:converters="clr-namespace:Wox.Converters" xmlns:converters="clr-namespace:Wox.Converters"
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100"> 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="{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 x:Name="lbResults" MaxHeight="300" AllowDrop="True" Drop="ListBoxItem_OnDrop" 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> <ListBox.Resources>
<!--SelectedItem with focus--> <!--SelectedItem with focus-->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>

View File

@@ -1,12 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using Wox.Helper; using Wox.Core.UserSettings;
using Wox.Plugin; using Wox.Plugin;
using Wox.Storage; using Wox.Storage;
using UserControl = System.Windows.Controls.UserControl; using UserControl = System.Windows.Controls.UserControl;
@@ -33,6 +31,8 @@ namespace Wox
public bool Dirty { get; set; } public bool Dirty { get; set; }
public int MaxResultsToShow { get { return UserSettingStorage.Instance.MaxResultsToShow * 50; } }
public void AddResults(List<Result> results) public void AddResults(List<Result> results)
{ {
if (Dirty) if (Dirty)

View File

@@ -6,6 +6,7 @@
xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin" xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
xmlns:converters="clr-namespace:Wox.Converters" xmlns:converters="clr-namespace:Wox.Converters"
xmlns:userSettings="clr-namespace:Wox.Core.UserSettings;assembly=Wox.Core" xmlns:userSettings="clr-namespace:Wox.Core.UserSettings;assembly=Wox.Core"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Icon="Images\app.png" Icon="Images\app.png"
Title="{DynamicResource woxsettings}" Title="{DynamicResource woxsettings}"
ResizeMode="NoResize" ResizeMode="NoResize"
@@ -38,6 +39,10 @@
<TextBlock Text="{DynamicResource language}"></TextBlock> <TextBlock Text="{DynamicResource language}"></TextBlock>
<ComboBox Margin="10 0 0 0" Width="100" x:Name="cbLanguages" /> <ComboBox Margin="10 0 0 0" Width="100" x:Name="cbLanguages" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="10">
<ComboBox Name="comboMaxResultsToShow"/>
<Label>Maximum number of results to show at a time</Label>
</StackPanel>
</StackPanel> </StackPanel>
</TabItem> </TabItem>
<TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin" PreviewMouseLeftButtonDown="TabPlugin_OnPreviewMouseLeftButtonDown"> <TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin" PreviewMouseLeftButtonDown="TabPlugin_OnPreviewMouseLeftButtonDown">

View File

@@ -87,11 +87,21 @@ namespace Wox
}; };
cbStartWithWindows.IsChecked = CheckApplicationIsStartupWithWindow(); cbStartWithWindows.IsChecked = CheckApplicationIsStartupWithWindow();
comboMaxResultsToShow.SelectionChanged += (o, e) =>
{
UserSettingStorage.Instance.MaxResultsToShow = (int)comboMaxResultsToShow.SelectedItem;
UserSettingStorage.Instance.Save();
MainWindow.pnlResult.lbResults.GetBindingExpression(MaxHeightProperty).UpdateTarget();
};
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive; cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
cbDontPromptUpdateMsg.IsChecked = UserSettingStorage.Instance.DontPromptUpdateMsg; cbDontPromptUpdateMsg.IsChecked = UserSettingStorage.Instance.DontPromptUpdateMsg;
cbRememberLastLocation.IsChecked = UserSettingStorage.Instance.RememberLastLaunchLocation; cbRememberLastLocation.IsChecked = UserSettingStorage.Instance.RememberLastLaunchLocation;
LoadLanguages(); LoadLanguages();
comboMaxResultsToShow.ItemsSource = Enumerable.Range(2, 16);
var maxResults = UserSettingStorage.Instance.MaxResultsToShow;
comboMaxResultsToShow.SelectedItem = maxResults == 0 ? 6 : maxResults;
#endregion #endregion

View File

@@ -351,6 +351,11 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\app.ico" /> <None Include="Resources\app.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\sleep.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup> <PropertyGroup>