Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CodeMaidShared/CodeMaidShared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<AutoGen>True</AutoGen>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UI\Bindable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Converters\BooleanAndConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Converters\BooleanInverseConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Converters\BooleanToVisibilityConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Converters\CodeItemParentHighestComplexityConverter.cs" />
Expand Down
67 changes: 67 additions & 0 deletions CodeMaidShared/UI/Converters/BooleanAndConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace SteveCadwallader.CodeMaid.UI.Converters
{
/// <summary>
/// A converter that performs a logical AND on all values.
/// </summary>
public class BooleanAndConverter : IMultiValueConverter
{
/// <summary>
/// The default <see cref="BooleanAndConverter" />.
/// </summary>
public static BooleanAndConverter Default = new BooleanAndConverter();

/// <summary>
/// Converts source values to a value for the binding target. The data binding engine calls
/// this method when it propagates the values from source bindings to the binding target.
/// </summary>
/// <param name="values">
/// The array of values that the source bindings in the <see
/// cref="T:System.Windows.Data.MultiBinding" /> produces. The value <see
/// cref="F:System.Windows.DependencyProperty.UnsetValue" /> indicates that the source
/// binding has no value to provide for conversion.
/// </param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter to use.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>
/// A converted value.If the method returns null, the valid null value is used.A return
/// value of <see cref="T:System.Windows.DependencyProperty" />.<see
/// cref="F:System.Windows.DependencyProperty.UnsetValue" /> indicates that the converter
/// did not produce a value, and that the binding will use the <see
/// cref="P:System.Windows.Data.BindingBase.FallbackValue" /> if it is available, or else
/// will use the default value.A return value of <see cref="T:System.Windows.Data.Binding"
/// />.<see cref="F:System.Windows.Data.Binding.DoNothing" /> indicates that the binding
/// does not transfer the value or use the <see
/// cref="P:System.Windows.Data.BindingBase.FallbackValue" /> or the default value.
/// </returns>
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values == null || values.Length < 1) return null;

return values.All(x => (bool)x);
}

/// <summary>
/// Converts a binding target value to the source binding values.
/// </summary>
/// <param name="value">The value that the binding target produces.</param>
/// <param name="targetTypes">
/// The array of types to convert to. The array length indicates the number and types of
/// values that are suggested for the method to return.
/// </param>
/// <param name="parameter">The converter parameter to use.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>
/// An array of values that have been converted from the target value back to the source values.
/// </returns>
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
21 changes: 13 additions & 8 deletions CodeMaidShared/UI/ToolWindows/BuildProgress/BuildProgressView.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<UserControl x:Class="SteveCadwallader.CodeMaid.UI.ToolWindows.BuildProgress.BuildProgressView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cnv="clr-namespace:SteveCadwallader.CodeMaid.UI.Converters"
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
xmlns:p="clr-namespace:SteveCadwallader.CodeMaid.Properties"
Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cnv="clr-namespace:SteveCadwallader.CodeMaid.UI.Converters"
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
xmlns:p="clr-namespace:SteveCadwallader.CodeMaid.Properties"
Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}"
Foreground="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowTextKey}}">
<Grid VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
Expand All @@ -13,8 +13,13 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<ProgressBar IsIndeterminate="{Binding IsProgressIndeterminate}" Maximum="1"
Value="{Binding ProgressPercentage}">
<ProgressBar Maximum="1" Value="{Binding ProgressPercentage}">
<ProgressBar.IsIndeterminate>
<MultiBinding Converter="{x:Static cnv:BooleanAndConverter.Default}">
<Binding Path="IsProgressIndeterminate" />
<Binding Path="IsVisible" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</ProgressBar.IsIndeterminate>
<ProgressBar.Style>
<Style TargetType="{x:Type ProgressBar}">
<Style.Triggers>
Expand Down