mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
moved the existing files popup to an error message , heralding the return of the overwrite install checkbox
This commit is contained in:
parent
cc76e3c699
commit
8edbb697b0
@ -136,6 +136,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
|
||||
private AbsolutePath LastInstallPath { get; set; }
|
||||
|
||||
[Reactive] public bool OverwriteFiles { get; set; }
|
||||
|
||||
|
||||
// Command properties
|
||||
public ReactiveCommand<Unit, Unit> ShowManifestCommand { get; }
|
||||
@ -226,6 +228,9 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
||||
});
|
||||
|
||||
this.WhenAnyValue(x => x.OverwriteFiles)
|
||||
.Subscribe(x => ConfirmOverwrite());
|
||||
|
||||
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
||||
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
||||
.DisposeWith(CompositeDisposable);
|
||||
@ -314,24 +319,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
yield return ErrorResponse.Fail("Installing in this folder may overwrite Wabbajack");
|
||||
}
|
||||
|
||||
if (installPath.ToString().Length != 0 && installPath != LastInstallPath &&
|
||||
if (installPath.ToString().Length != 0 && installPath != LastInstallPath && !OverwriteFiles &&
|
||||
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
|
||||
{
|
||||
string message =
|
||||
"There are files already in the chosen install path, if you are updating an existing modlist, this is fine. " + Environment.NewLine +
|
||||
" Otherwise, please ensure you intend for the folder contents to be deleted during the modlist install." + Environment.NewLine +
|
||||
" Continue? ";
|
||||
string title = "Files found in install folder";
|
||||
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
|
||||
DialogResult result = MessageBox.Show(message, title, buttons);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
// everythings fine
|
||||
}
|
||||
else
|
||||
{
|
||||
Installer.Location.TargetPath = "".ToAbsolutePath();
|
||||
}
|
||||
yield return ErrorResponse.Fail("There are files in the install folder, please tick 'Overwrite Installation' to confirm you want to install to this folder, if you are updating an existing modlist, this is fine.");
|
||||
}
|
||||
|
||||
if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
|
||||
@ -455,6 +446,13 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfirmOverwrite()
|
||||
{
|
||||
AbsolutePath prev = Installer.Location.TargetPath;
|
||||
Installer.Location.TargetPath = "".ToAbsolutePath();
|
||||
Installer.Location.TargetPath = prev;
|
||||
}
|
||||
|
||||
private async Task BeginInstall()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
|
@ -39,6 +39,9 @@ namespace Wabbajack
|
||||
|
||||
public bool SupportsAfterInstallNavigation => true;
|
||||
|
||||
[Reactive]
|
||||
public bool AutomaticallyOverwrite { get; set; }
|
||||
|
||||
public int ConfigVisualVerticalOffset => 25;
|
||||
|
||||
public MO2InstallerVM(InstallerVM installerVM)
|
||||
@ -163,6 +166,7 @@ namespace Wabbajack
|
||||
if (settings == null) return;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
settings.AutomaticallyOverrideExistingInstall = AutomaticallyOverwrite;
|
||||
}
|
||||
|
||||
public void AfterInstallNavigation()
|
||||
|
@ -81,10 +81,11 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<local:BeginButton Grid.Row="1"
|
||||
x:Name="BeginButton"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIconGlow"
|
||||
@ -99,8 +100,27 @@
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIcon"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid" />
|
||||
<CheckBox Grid.Row="2" Grid.Column="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
x:Name="OverwriteCheckBox"
|
||||
Content="Overwrite Installation"
|
||||
IsChecked="False"
|
||||
ToolTip="Confirm to overwrite files in install folder.">
|
||||
<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>
|
||||
</Grid>
|
||||
</rxui:ReactiveUserControl>
|
||||
|
@ -39,6 +39,8 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||
.BindToStrict(this, x => x.BeginButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.BindStrict(ViewModel, vm => vm.OverwriteFiles, x => x.OverwriteCheckBox.IsChecked)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
// Error handling
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user