mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Fix #565
1. Fix resultlistbox visibility 2. Fix #565 3. Remove unused convertor
This commit is contained in:
@@ -1,40 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
|
|
||||||
namespace Wox.Converters
|
|
||||||
{
|
|
||||||
public class OpacityModeConverter : ConvertorBase<OpacityModeConverter>
|
|
||||||
{
|
|
||||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (!(value is OpacityMode)) return value.ToString();
|
|
||||||
var mode = (OpacityMode) value;
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case OpacityMode.Normal:
|
|
||||||
return "Normal Window";
|
|
||||||
case OpacityMode.LayeredWindow:
|
|
||||||
{
|
|
||||||
if (Environment.OSVersion.Version.Major < 5)
|
|
||||||
return "Layered Window (not supported by your Windows)";
|
|
||||||
if (Environment.OSVersion.Version.Major == 5)
|
|
||||||
return "Layered Window (not recommended on your Windows)";
|
|
||||||
return "Layered Window";
|
|
||||||
}
|
|
||||||
case OpacityMode.DWM:
|
|
||||||
{
|
|
||||||
if (Environment.OSVersion.Version.Major < 6)
|
|
||||||
return "DWM-Enabled Window (not supported by your Windows)";
|
|
||||||
return "DWM-Enabled Window";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace Wox.Converters
|
|
||||||
{
|
|
||||||
public class StringEmptyConverter : ConvertorBase<StringEmptyConverter>
|
|
||||||
{
|
|
||||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty((string)value) ? parameter : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Windows;
|
|
||||||
using Wox.Plugin;
|
|
||||||
|
|
||||||
namespace Wox.Converters
|
|
||||||
{
|
|
||||||
public class StringNullOrEmptyToVisibilityConverter : ConvertorBase<StringNullOrEmptyToVisibilityConverter>
|
|
||||||
{
|
|
||||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContextMenuEmptyToWidthConverter : ConvertorBase<ContextMenuEmptyToWidthConverter>
|
|
||||||
{
|
|
||||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
List<Result> results = value as List<Result>;
|
|
||||||
return results == null || results.Count == 0 ? 0 : 17;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
VerticalAlignment="Center" ToolTip="{Binding Title}" x:Name="tbTitle"
|
VerticalAlignment="Center" ToolTip="{Binding Title}" x:Name="tbTitle"
|
||||||
Text="{Binding Title}" />
|
Text="{Binding Title}" />
|
||||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding SubTitle}"
|
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding SubTitle}"
|
||||||
Visibility="{Binding SubTitle, Converter={converters:StringNullOrEmptyToVisibilityConverter}}"
|
|
||||||
Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}" />
|
Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -79,7 +79,6 @@
|
|||||||
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Metadata.Name}"
|
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Metadata.Name}"
|
||||||
x:Name="tbTitle" Text="{Binding Metadata.Name}" />
|
x:Name="tbTitle" Text="{Binding Metadata.Name}" />
|
||||||
<TextBlock ToolTip="{Binding Metadata.Description}"
|
<TextBlock ToolTip="{Binding Metadata.Description}"
|
||||||
Visibility="{Binding Metadata.Description, Converter={converters:StringNullOrEmptyToVisibilityConverter}}"
|
|
||||||
Grid.Row="1" x:Name="tbSubTitle"
|
Grid.Row="1" x:Name="tbSubTitle"
|
||||||
Text="{Binding Metadata.Description}" Opacity="0.5" />
|
Text="{Binding Metadata.Description}" Opacity="0.5" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -115,8 +114,7 @@
|
|||||||
x:Name="pluginAuthor" Text="{DynamicResource author}" />
|
x:Name="pluginAuthor" Text="{DynamicResource author}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5"
|
<TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5"
|
||||||
ToolTip="{Binding Source=pluginSubTitle, Path=Text}"
|
ToolTip="{Binding Source=pluginSubTitle, Path=Text}"/>
|
||||||
Visibility="{Binding Source=pluginSubTitle, Path=Text, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" />
|
|
||||||
<DockPanel Grid.Row="2" Margin="0 10 0 8">
|
<DockPanel Grid.Row="2" Margin="0 10 0 8">
|
||||||
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
|
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
|
||||||
<TextBlock Text="{DynamicResource disable}" />
|
<TextBlock Text="{DynamicResource disable}" />
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ namespace Wox.ViewModel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Results.Clear();
|
Results.Clear();
|
||||||
|
ResultListBoxVisibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,6 +566,11 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
ResultListBoxVisibility = Visibility.Visible;
|
ResultListBoxVisibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResultListBoxVisibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -124,9 +124,6 @@
|
|||||||
<Compile Include="CommandArgs\ToggleCommandArg.cs" />
|
<Compile Include="CommandArgs\ToggleCommandArg.cs" />
|
||||||
<Compile Include="Converters\ConvertorBase.cs" />
|
<Compile Include="Converters\ConvertorBase.cs" />
|
||||||
<Compile Include="Converters\ImagePathConverter.cs" />
|
<Compile Include="Converters\ImagePathConverter.cs" />
|
||||||
<Compile Include="Converters\OpacityModeConverter.cs" />
|
|
||||||
<Compile Include="Converters\StringEmptyConverter.cs" />
|
|
||||||
<Compile Include="Converters\StringNullOrEmptyToVisibilityConverter.cs" />
|
|
||||||
<Compile Include="Helper\VisibilityExtensions.cs" />
|
<Compile Include="Helper\VisibilityExtensions.cs" />
|
||||||
<Compile Include="Helper\SingletonWindowOpener.cs" />
|
<Compile Include="Helper\SingletonWindowOpener.cs" />
|
||||||
<Compile Include="ImageLoader\ImageCache.cs" />
|
<Compile Include="ImageLoader\ImageCache.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user