Improve the DisableDropSound indicator tooltip.

This commit is contained in:
GlenCFL 2018-12-06 10:11:22 -05:00
parent 72b874e7d5
commit 7fe896b1d8
3 changed files with 61 additions and 6 deletions

View File

@ -0,0 +1,38 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Filtration.Converters
{
class DisabledDefaultSoundTooltipConverter : IMultiValueConverter
{
private static readonly string appendage = "\nNote: the default drop sound is disabled for this block.";
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values[0] == DependencyProperty.UnsetValue ||
values[1] == DependencyProperty.UnsetValue)
{
return string.Empty;
}
var baseText = (string)(values[0]);
var hasDisabledDefaultSound = (bool)(values[1]);
if (hasDisabledDefaultSound)
{
return $"{baseText}{appendage}";
}
else
{
return baseText;
}
}
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -211,6 +211,7 @@
<Compile Include="Converters\BooleanToBlockActionConverter.cs" /> <Compile Include="Converters\BooleanToBlockActionConverter.cs" />
<Compile Include="Converters\BlockItemToRemoveEnabledVisibilityConverter.cs" /> <Compile Include="Converters\BlockItemToRemoveEnabledVisibilityConverter.cs" />
<Compile Include="Converters\DisabledDefaultSoundConverter.cs" /> <Compile Include="Converters\DisabledDefaultSoundConverter.cs" />
<Compile Include="Converters\DisabledDefaultSoundTooltipConverter.cs" />
<Compile Include="Converters\MinimapIconToCroppedBitmapConverter.cs" /> <Compile Include="Converters\MinimapIconToCroppedBitmapConverter.cs" />
<Compile Include="Converters\HashSignRemovalConverter.cs" /> <Compile Include="Converters\HashSignRemovalConverter.cs" />
<Compile Include="Converters\ItemRarityConverter.cs" /> <Compile Include="Converters\ItemRarityConverter.cs" />

View File

@ -19,6 +19,7 @@
<converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" /> <converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" />
<converters:MinimapIconToCroppedBitmapConverter x:Key="MinimapIconToCroppedBitmapConverter"/> <converters:MinimapIconToCroppedBitmapConverter x:Key="MinimapIconToCroppedBitmapConverter"/>
<converters:DisabledDefaultSoundConverter x:Key="DisabledDefaultSoundConverter"/> <converters:DisabledDefaultSoundConverter x:Key="DisabledDefaultSoundConverter"/>
<converters:DisabledDefaultSoundTooltipConverter x:Key="DisabledDefaultSoundTooltipConverter"/>
<Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle"> <Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle">
<Setter Property="LayoutTransform"> <Setter Property="LayoutTransform">
<Setter.Value> <Setter.Value>
@ -146,8 +147,13 @@
Margin="0,0,3,0" Margin="0,0,3,0"
Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}"
Background="Transparent" Background="Transparent"
BorderBrush="Transparent" BorderBrush="Transparent">
ToolTip="Click to preview drop sound"> <Button.ToolTip>
<MultiBinding Converter="{StaticResource DisabledDefaultSoundTooltipConverter}">
<Binding Source="Click to preview drop sound."/>
<Binding Path="HasDisabledDefaultSound"/>
</MultiBinding>
</Button.ToolTip>
<Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button> </Button>
<Button Command="{Binding PlayPositionalSoundCommand}" <Button Command="{Binding PlayPositionalSoundCommand}"
@ -158,8 +164,13 @@
Margin="0,0,3,0" Margin="0,0,3,0"
Visibility="{Binding HasPositionalSound, Converter={StaticResource BooleanVisibilityConverter}}" Visibility="{Binding HasPositionalSound, Converter={StaticResource BooleanVisibilityConverter}}"
Background="Transparent" Background="Transparent"
BorderBrush="Transparent" BorderBrush="Transparent">
ToolTip="Click to preview positional drop sound"> <Button.ToolTip>
<MultiBinding Converter="{StaticResource DisabledDefaultSoundTooltipConverter}">
<Binding Source="Click to preview positional drop sound."/>
<Binding Path="HasDisabledDefaultSound"/>
</MultiBinding>
</Button.ToolTip>
<Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button> </Button>
<Button Command="{Binding PlayCustomSoundCommand}" <Button Command="{Binding PlayCustomSoundCommand}"
@ -170,8 +181,13 @@
Margin="0,0,3,0" Margin="0,0,3,0"
Visibility="{Binding HasCustomSound, Converter={StaticResource BooleanVisibilityConverter}}" Visibility="{Binding HasCustomSound, Converter={StaticResource BooleanVisibilityConverter}}"
Background="Transparent" Background="Transparent"
BorderBrush="Transparent" BorderBrush="Transparent">
ToolTip="Click to preview custom drop sound"> <Button.ToolTip>
<MultiBinding Converter="{StaticResource DisabledDefaultSoundTooltipConverter}">
<Binding Source="Click to preview custom drop sound."/>
<Binding Path="HasDisabledDefaultSound"/>
</MultiBinding>
</Button.ToolTip>
<Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Image Source="{Binding HasDisabledDefaultSound, Converter={StaticResource DisabledDefaultSoundConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button> </Button>
<Line Y1="5" Y2="38" StrokeThickness="2" Panel.ZIndex="999" <Line Y1="5" Y2="38" StrokeThickness="2" Panel.ZIndex="999"