MO2 installation config overwrite checkbox

This commit is contained in:
Justin Swanson 2019-12-10 21:39:09 -06:00
parent a339e621c1
commit 9e16b701f9
6 changed files with 86 additions and 52 deletions

View File

@ -11,6 +11,7 @@ namespace Wabbajack
{
public interface ISubInstallerVM
{
InstallerVM Parent { get; }
IReactiveCommand BeginCommand { get; }
AInstaller ActiveInstallation { get; }
void Unload();

View File

@ -15,7 +15,7 @@ namespace Wabbajack
{
public class MO2InstallerVM : ViewModel, ISubInstallerVM
{
private InstallerVM _installerVM;
public InstallerVM Parent { get; }
public IReactiveCommand BeginCommand { get; }
@ -34,7 +34,7 @@ namespace Wabbajack
public MO2InstallerVM(InstallerVM installerVM)
{
_installerVM = installerVM;
Parent = installerVM;
Location = new FilePickerVM()
{
@ -168,7 +168,7 @@ namespace Wabbajack
private void SaveSettings(Mo2ModlistInstallationSettings settings)
{
_installerVM.MWVM.Settings.Installer.LastInstalledListLocation = _installerVM.ModListLocation.TargetPath;
Parent.MWVM.Settings.Installer.LastInstalledListLocation = Parent.ModListLocation.TargetPath;
if (settings == null) return;
settings.InstallationLocation = Location.TargetPath;
settings.DownloadLocation = DownloadLocation.TargetPath;

View File

@ -13,6 +13,8 @@ namespace Wabbajack
{
public class VortexInstallerVM : ViewModel, ISubInstallerVM
{
public InstallerVM Parent { get; }
public IReactiveCommand BeginCommand { get; }
[Reactive]
@ -29,6 +31,8 @@ namespace Wabbajack
public VortexInstallerVM(InstallerVM installerVM)
{
Parent = installerVM;
_TargetGame = installerVM.WhenAny(x => x.ModList.SourceModList.GameType)
.ToProperty(this, nameof(TargetGame));

View File

@ -26,7 +26,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="47" />
<RowDefinition Height="4*" />
<RowDefinition Height="*" MinHeight="150" />
<RowDefinition Height="*" MinHeight="175" />
</Grid.RowDefinitions>
<Rectangle
x:Name="BorderEdgeFadeDown"
@ -289,49 +289,19 @@
Background="Transparent"
VerticalScrollBarVisibility="Auto"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="120" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="40" />
<RowDefinition Height="80" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Target Modlist"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="1"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding ModListLocation}"
FontSize="14" />
<ContentPresenter
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="0"
Content="{Binding Installer}">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type local:MO2InstallerVM}">
<local:MO2InstallerConfigView />
</DataTemplate>
<DataTemplate DataType="{x:Type local:VortexInstallerVM}">
<local:VortexInstallerConfigView />
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
</Grid>
<ContentPresenter
Margin="0"
VerticalAlignment="Center"
Content="{Binding Installer}">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type local:MO2InstallerVM}">
<local:MO2InstallerConfigView />
</DataTemplate>
<DataTemplate DataType="{x:Type local:VortexInstallerVM}">
<local:VortexInstallerConfigView />
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
</ScrollViewer>
<local:BeginButton
Grid.Column="2"

View File

@ -3,6 +3,7 @@
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:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
@ -15,11 +16,29 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Target Modlist"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="1"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding Parent.ModListLocation}"
FontSize="14" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@ -27,14 +46,14 @@
Text="Installation Location"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="0"
Grid.Row="2"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding Location}"
FontSize="14" />
<TextBlock
Grid.Row="1"
Grid.Row="3"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@ -42,11 +61,29 @@
Text="Download Location"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="1"
Grid.Row="3"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding DownloadLocation}"
FontSize="14" />
<CheckBox
Grid.Row="4"
Grid.Column="2"
HorizontalAlignment="Right"
Content="Overwrite Installation"
IsChecked="{Binding AutomaticallyOverwrite}"
ToolTip="If installing over an existing installation, automatically replace it without asking permission.">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Setter Property="Opacity" Value="0.6" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="Opacity" Value="1" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
</Grid>
</UserControl>

View File

@ -9,6 +9,28 @@
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<!-- Nothing so far -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="120" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Target Modlist"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="0"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
DataContext="{Binding Parent.ModListLocation}"
FontSize="14" />
</Grid>
</UserControl>