mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Merge pull request #454 from Wox-launcher/dotnet45
Upgrade Wox to .net 4.5
This commit is contained in:
@@ -7,44 +7,82 @@
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100">
|
||||
|
||||
<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}"/>
|
||||
<!--SelectedItem without focus-->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
|
||||
</ListBox.Resources>
|
||||
<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.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- a result item height is 50 including margin -->
|
||||
<Grid HorizontalAlignment="Stretch" Height="40" VerticalAlignment="Stretch" Margin="5" Cursor="Hand">
|
||||
<Grid HorizontalAlignment="Stretch" Height="40" VerticalAlignment="Stretch" Margin="5"
|
||||
Cursor="Hand">
|
||||
<Grid.Resources>
|
||||
<converters:ImagePathConverter x:Key="ImageConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="32"></ColumnDefinition>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="32" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="0" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="imgIco" Width="32" Height="32" HorizontalAlignment="Left" Source="{Binding FullIcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" >
|
||||
</Image>
|
||||
<Image x:Name="imgIco" Width="32" Height="32" HorizontalAlignment="Left"
|
||||
Source="{Binding FullIcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" />
|
||||
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{DynamicResource ItemTitleStyle}" DockPanel.Dock="Left" VerticalAlignment="Center" ToolTip="{Binding Title}" x:Name="tbTitle" Text="{Binding Title}"></TextBlock>
|
||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding SubTitle}" Visibility="{Binding SubTitle, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}"></TextBlock>
|
||||
<TextBlock Style="{DynamicResource ItemTitleStyle}" DockPanel.Dock="Left"
|
||||
VerticalAlignment="Center" ToolTip="{Binding Title}" x:Name="tbTitle"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding SubTitle}"
|
||||
Visibility="{Binding SubTitle, Converter={converters:StringNullOrEmptyToVisibilityConverter}}"
|
||||
Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}" />
|
||||
</Grid>
|
||||
<TextBlock Grid.Column="2" x:Name="tbItemNumber" Style="{DynamicResource ItemNumberStyle}" Text="9"></TextBlock>
|
||||
<TextBlock Grid.Column="2" x:Name="tbItemNumber" Style="{DynamicResource ItemNumberStyle}" Text="9"/>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
|
||||
<Setter TargetName="tbTitle" Property="Style" Value="{DynamicResource ItemTitleSelectedStyle}"/>
|
||||
<Setter TargetName="tbSubTitle" Property="Style" Value="{DynamicResource ItemSubTitleSelectedStyle}"/>
|
||||
<DataTrigger
|
||||
Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
|
||||
Value="True">
|
||||
<Setter TargetName="tbTitle" Property="Style" Value="{DynamicResource ItemTitleSelectedStyle}" />
|
||||
<Setter TargetName="tbSubTitle" Property="Style"
|
||||
Value="{DynamicResource ItemSubTitleSelectedStyle}" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<!--http://stackoverflow.com/questions/16819577/setting-background-color-or-wpf-4-0-listbox-windows-8/#16820062-->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Border x:Name="Bd"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background"
|
||||
Value="{DynamicResource ItemSelectedBackgroundColor}" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush"
|
||||
Value="{DynamicResource ItemSelectedBackgroundColor}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
</UserControl>
|
||||
@@ -60,14 +60,15 @@ namespace Wox
|
||||
{
|
||||
lock (_resultsUpdateLock)
|
||||
{
|
||||
var resultCopy = _results.ToList();
|
||||
var oldResults = resultCopy.Where(r => r.PluginID == resultId).ToList();
|
||||
// todo use async to do new result calculation
|
||||
var resultsCopy = _results.ToList();
|
||||
var oldResults = resultsCopy.Where(r => r.PluginID == resultId).ToList();
|
||||
// intersection of A (old results) and B (new newResults)
|
||||
var intersection = oldResults.Intersect(newResults).ToList();
|
||||
// remove result of relative complement of B in A
|
||||
foreach (var result in oldResults.Except(intersection))
|
||||
{
|
||||
resultCopy.Remove(result);
|
||||
resultsCopy.Remove(result);
|
||||
}
|
||||
|
||||
// update scores
|
||||
@@ -80,31 +81,31 @@ namespace Wox
|
||||
}
|
||||
|
||||
// update index for result in intersection of A and B
|
||||
foreach (var result in intersection)
|
||||
foreach (var commonResult in intersection)
|
||||
{
|
||||
int oldIndex = resultCopy.IndexOf(result);
|
||||
int oldScore = resultCopy[oldIndex].Score;
|
||||
if (result.Score != oldScore)
|
||||
int oldIndex = resultsCopy.IndexOf(commonResult);
|
||||
int oldScore = resultsCopy[oldIndex].Score;
|
||||
int newScore = newResults[newResults.IndexOf(commonResult)].Score;
|
||||
if (newScore != oldScore)
|
||||
{
|
||||
int newIndex = InsertIndexOf(result.Score, resultCopy);
|
||||
if (newIndex != oldIndex)
|
||||
{
|
||||
var item = resultCopy[oldIndex];
|
||||
resultCopy.RemoveAt(oldIndex);
|
||||
resultCopy.Insert(newIndex, item);
|
||||
}
|
||||
var oldResult = resultsCopy[oldIndex];
|
||||
oldResult.Score = newScore;
|
||||
resultsCopy.RemoveAt(oldIndex);
|
||||
int newIndex = InsertIndexOf(newScore, resultsCopy);
|
||||
resultsCopy.Insert(newIndex, oldResult);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// insert result in relative complement of A in B
|
||||
foreach (var result in newResults.Except(intersection))
|
||||
{
|
||||
int newIndex = InsertIndexOf(result.Score, resultCopy);
|
||||
resultCopy.Insert(newIndex, result);
|
||||
int newIndex = InsertIndexOf(result.Score, resultsCopy);
|
||||
resultsCopy.Insert(newIndex, result);
|
||||
}
|
||||
|
||||
// update UI in one run, so it can avoid UI flickering
|
||||
_results.Update(resultCopy);
|
||||
_results.Update(resultsCopy);
|
||||
|
||||
lbResults.Margin = lbResults.Items.Count > 0 ? new Thickness { Top = 8 } : new Thickness { Top = 0 };
|
||||
SelectFirst();
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#356ef3</SolidColorBrush>
|
||||
|
||||
<!-- button style in the middle of the scrollbar -->
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#356ef3</SolidColorBrush>
|
||||
|
||||
<!-- button style in the middle of the scrollbar -->
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</Style>
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#4F6180</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#4F6180</SolidColorBrush>
|
||||
|
||||
<!-- button style in the middle of the scrollbar -->
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#ffffff" />
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#00AAF6</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#00AAF6</SolidColorBrush>
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#F6F6FF" />
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#3875D7</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#3875D7</SolidColorBrush>
|
||||
|
||||
<!-- button style in the middle of the scrollbar -->
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#c2c2c2" />
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#006ac1</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#006ac1</SolidColorBrush>
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
|
||||
</Style>
|
||||
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#c2c2c2" />
|
||||
</Style>
|
||||
<Color x:Key="ItemSelectedBackgroundColor">#cc1081</Color>
|
||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#cc1081</SolidColorBrush>
|
||||
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}"></Style>
|
||||
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}"></Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Wox</RootNamespace>
|
||||
<AssemblyName>Wox</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -61,11 +61,11 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Exceptionless, Version=1.5.2121.0, Culture=neutral, PublicKeyToken=fc181f0a46f65747, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net35\Exceptionless.dll</HintPath>
|
||||
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net45\Exceptionless.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Exceptionless.Models, Version=1.5.2121.0, Culture=neutral, PublicKeyToken=fc181f0a46f65747, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net35\Exceptionless.Models.dll</HintPath>
|
||||
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net45\Exceptionless.Models.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
@@ -77,7 +77,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NHotkey, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -98,6 +98,7 @@
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Exceptionless" version="1.5.2121" targetFramework="net35" />
|
||||
<package id="InputSimulator" version="1.0.4.0" targetFramework="net35" />
|
||||
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net35" />
|
||||
<package id="NHotkey" version="1.2.1" targetFramework="net35" />
|
||||
<package id="NHotkey.Wpf" version="1.2.1" targetFramework="net35" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net35" />
|
||||
<package id="Exceptionless" version="1.5.2121" targetFramework="net452" />
|
||||
<package id="InputSimulator" version="1.0.4.0" targetFramework="net452" />
|
||||
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NHotkey" version="1.2.1" targetFramework="net452" />
|
||||
<package id="NHotkey.Wpf" version="1.2.1" targetFramework="net452" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user