Fix to disable inputs when compiling

This commit is contained in:
Justin Swanson 2019-11-09 19:29:00 -06:00
parent bf9c315a2f
commit 451dee01b6
4 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace Wabbajack
{
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException($"The target must be of type bool");
return !((bool)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException($"The target must be of type bool");
return !((bool)value);
}
}
}

View File

@ -10,6 +10,7 @@
<!--Converters-->
<local:BoolToVisibilityConverter x:Key="bool2VisibilityConverter" />
<local:BoolToVisibilityHiddenConverter x:Key="bool2VisibilityHiddenConverter" />
<local:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<local:IsNotNullVisibilityConverter x:Key="IsNotNullVisibilityConverter"/>
<!--Colors-->

View File

@ -30,7 +30,7 @@
Margin="5,0,5,5"
Background="Transparent"
HorizontalScrollBarVisibility="Disabled"
IsEnabled="{Binding UIReady}"
IsEnabled="{Binding Compiling, Converter={StaticResource InverseBooleanConverter}}"
VerticalScrollBarVisibility="Auto">
<StackPanel
Margin="0,20,0,0"

View File

@ -161,6 +161,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Converters\InverseBooleanConverter.cs" />
<Compile Include="Converters\BoolToVisibilityHiddenConverter.cs" />
<Compile Include="Views\BeginButton.xaml.cs">
<DependentUpon>BeginButton.xaml</DependentUpon>