Compiler Source radio button setup

This commit is contained in:
Justin Swanson 2019-11-10 00:39:40 -06:00
parent 69dd759dd1
commit 4bb76c57ef
11 changed files with 240 additions and 16 deletions

View File

@ -0,0 +1,24 @@
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
{
public class EqualsToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return object.Equals(value, parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return parameter;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -12,6 +12,7 @@
<local:BoolToVisibilityHiddenConverter x:Key="bool2VisibilityHiddenConverter" />
<local:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<local:IsNotNullVisibilityConverter x:Key="IsNotNullVisibilityConverter"/>
<local:EqualsToBoolConverter x:Key="EqualsToBoolConverter"/>
<!--Colors-->
<Color x:Key="WindowBackgroundColor">#121212</Color>

View File

@ -13,6 +13,12 @@ using Wabbajack.Lib;
namespace Wabbajack
{
public enum CompilerType
{
MO2,
Vortex
}
public class CompilerVM : ViewModel
{
public MainWindowVM MWVM { get; }
@ -54,6 +60,9 @@ namespace Wabbajack
public IReactiveCommand BeginCommand { get; }
[Reactive]
public CompilerType SelectedCompilerType { get; set; }
public CompilerVM(MainWindowVM mainWindowVM, string source)
{
this.MWVM = mainWindowVM;

View File

@ -60,7 +60,7 @@
<ScrollViewer
Grid.Row="1"
Grid.Column="1"
Margin="5,0,5,5"
Margin="5"
Background="Transparent"
HorizontalScrollBarVisibility="Disabled"
IsEnabled="{Binding Compiling, Converter={StaticResource InverseBooleanConverter}}"
@ -149,50 +149,104 @@
ClipToBounds="False"
Visibility="{Binding Compiling, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
<Grid
Grid.Row="0"
Grid.RowSpan="5"
Grid.Column="0"
Margin="15"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<local:ImageRadioButtonView
Grid.Row="0"
Height="35"
Margin="4"
IsChecked="{Binding SelectedCompilerType, Converter={StaticResource EqualsToBoolConverter}, ConverterParameter={x:Static local:CompilerType.MO2}}">
<local:ImageRadioButtonView.Image>
<BitmapImage UriSource="../Resources/MO2Button.png" />
</local:ImageRadioButtonView.Image>
</local:ImageRadioButtonView>
<local:ImageRadioButtonView
Grid.Row="1"
Height="35"
Margin="4"
IsChecked="{Binding SelectedCompilerType, Converter={StaticResource EqualsToBoolConverter}, ConverterParameter={x:Static local:CompilerType.Vortex}}">
<local:ImageRadioButtonView.Image>
<BitmapImage UriSource="../Resources/VortexButton.png" />
</local:ImageRadioButtonView.Image>
</local:ImageRadioButtonView>
</Grid>
<TextBlock
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Modlist Location"
TextAlignment="Center" />
TextAlignment="Center"
ToolTip="The MO2 modlist.txt file you want to use as your source" />
<local:FilePicker
Grid.Row="0"
Grid.Column="2"
Grid.Row="1"
Grid.Column="3"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding ModlistLocation}"
FontSize="14" />
FontSize="14"
ToolTip="The MO2 modlist.txt file you want to use as your source" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Download Location"
TextAlignment="Center" />
TextAlignment="Center"
ToolTip="The folder where MO2 downloads your mods." />
<local:FilePicker
Grid.Row="1"
Grid.Column="2"
Grid.Row="2"
Grid.Column="3"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding DownloadLocation}"
FontSize="14" />
FontSize="14"
ToolTip="The folder where MO2 downloads your mods." />
<TextBlock
Grid.Row="3"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Output Location"
TextAlignment="Center"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<local:FilePicker
Grid.Row="3"
Grid.Column="3"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding OutputLocation}"
FontSize="14"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<local:BeginButton
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="4"
Grid.RowSpan="5"
Grid.Column="5"
Command="{Binding BeginCommand}" />
</Grid>
</Grid>

View File

@ -0,0 +1,67 @@
<UserControl
x:Class="Wabbajack.ImageRadioButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="35"
ClipToBounds="False"
mc:Ignorable="d">
<Grid>
<Border
x:Name="HoverOverPrimaryGlow"
Margin="-10"
Background="{StaticResource PrimaryVariantBrush}"
CornerRadius="15"
Opacity="0.3"
Visibility="{Binding IsChecked, Converter={StaticResource bool2VisibilityHiddenConverter}, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<Border.Effect>
<BlurEffect Radius="15" />
</Border.Effect>
</Border>
<Border
x:Name="SelectedSecondaryGlow"
Margin="-2"
Background="{StaticResource SecondaryBrush}"
CornerRadius="12"
Opacity="0.3"
Visibility="{Binding IsMouseOver, Converter={StaticResource bool2VisibilityHiddenConverter}, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<Border.Effect>
<BlurEffect Radius="10" />
</Border.Effect>
</Border>
<Button
Background="Transparent"
BorderThickness="0"
Click="Button_Click">
<Image Source="{Binding Image, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<Image.Style>
<Style TargetType="Image">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="False" />
<Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="False" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Effect">
<Setter.Value>
<BlurEffect Radius="2" />
</Setter.Value>
</Setter>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Button>
<Border
BorderBrush="{StaticResource SecondaryBrush}"
BorderThickness="1"
CornerRadius="9"
Opacity="0.8"
Visibility="{Binding IsChecked, Converter={StaticResource bool2VisibilityHiddenConverter}, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
</Grid>
</UserControl>

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for ImageRadioButtonView.xaml
/// </summary>
public partial class ImageRadioButtonView : UserControl
{
public bool IsChecked
{
get => (bool)GetValue(IsCheckedProperty);
set => SetValue(IsCheckedProperty, value);
}
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(nameof(IsChecked), typeof(bool), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public BitmapImage Image
{
get => (BitmapImage)GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}
public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(nameof(Image), typeof(BitmapImage), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(BitmapImage)));
public ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(ICommand)));
public ImageRadioButtonView()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.IsChecked = true;
}
}
}

View File

@ -161,11 +161,15 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="BorderFadeDownView.xaml.cs">
<Compile Include="Converters\EqualsToBoolConverter.cs" />
<Compile Include="Views\BorderFadeDownView.xaml.cs">
<DependentUpon>BorderFadeDownView.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\InverseBooleanConverter.cs" />
<Compile Include="Converters\BoolToVisibilityHiddenConverter.cs" />
<Compile Include="Views\RadioButtonView.xaml.cs">
<DependentUpon>RadioButtonView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\BeginButton.xaml.cs">
<DependentUpon>BeginButton.xaml</DependentUpon>
</Compile>
@ -216,7 +220,11 @@
<DependentUpon>TextViewer.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserControlRx.cs" />
<Page Include="BorderFadeDownView.xaml">
<Page Include="Views\BorderFadeDownView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\RadioButtonView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@ -450,5 +458,9 @@
<ItemGroup>
<EmbeddedResource Include="Resources\Wabba_Mouth.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\MO2Button.png" />
<Resource Include="Resources\VortexButton.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>