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
@ -135,6 +135,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
public LogStream LoggerProvider { get; }
|
public LogStream LoggerProvider { get; }
|
||||||
|
|
||||||
private AbsolutePath LastInstallPath { get; set; }
|
private AbsolutePath LastInstallPath { get; set; }
|
||||||
|
|
||||||
|
[Reactive] public bool OverwriteFiles { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// Command properties
|
// Command properties
|
||||||
@ -225,7 +227,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
{
|
{
|
||||||
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.WhenAnyValue(x => x.OverwriteFiles)
|
||||||
|
.Subscribe(x => ConfirmOverwrite());
|
||||||
|
|
||||||
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
||||||
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
||||||
.DisposeWith(CompositeDisposable);
|
.DisposeWith(CompositeDisposable);
|
||||||
@ -314,24 +319,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
yield return ErrorResponse.Fail("Installing in this folder may overwrite Wabbajack");
|
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())
|
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
|
||||||
{
|
{
|
||||||
string message =
|
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.");
|
||||||
"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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
|
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()
|
private async Task BeginInstall()
|
||||||
{
|
{
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
|
@ -39,6 +39,9 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public bool SupportsAfterInstallNavigation => true;
|
public bool SupportsAfterInstallNavigation => true;
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public bool AutomaticallyOverwrite { get; set; }
|
||||||
|
|
||||||
public int ConfigVisualVerticalOffset => 25;
|
public int ConfigVisualVerticalOffset => 25;
|
||||||
|
|
||||||
public MO2InstallerVM(InstallerVM installerVM)
|
public MO2InstallerVM(InstallerVM installerVM)
|
||||||
@ -163,6 +166,7 @@ namespace Wabbajack
|
|||||||
if (settings == null) return;
|
if (settings == null) return;
|
||||||
settings.InstallationLocation = Location.TargetPath;
|
settings.InstallationLocation = Location.TargetPath;
|
||||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||||
|
settings.AutomaticallyOverrideExistingInstall = AutomaticallyOverwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AfterInstallNavigation()
|
public void AfterInstallNavigation()
|
||||||
|
@ -81,10 +81,11 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<local:BeginButton Grid.Row="1"
|
<local:BeginButton Grid.Row="1"
|
||||||
x:Name="BeginButton"
|
x:Name="BeginButton"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<icon:PackIconFontAwesome Grid.Row="2"
|
<icon:PackIconFontAwesome Grid.Row="2"
|
||||||
x:Name="ErrorSummaryIconGlow"
|
x:Name="ErrorSummaryIconGlow"
|
||||||
@ -99,8 +100,27 @@
|
|||||||
<icon:PackIconFontAwesome Grid.Row="2"
|
<icon:PackIconFontAwesome Grid.Row="2"
|
||||||
x:Name="ErrorSummaryIcon"
|
x:Name="ErrorSummaryIcon"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Top"
|
||||||
Foreground="{StaticResource WarningBrush}"
|
Foreground="{StaticResource WarningBrush}"
|
||||||
Kind="ExclamationTriangleSolid" />
|
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>
|
||||||
</Grid>
|
</Grid>
|
||||||
</rxui:ReactiveUserControl>
|
</rxui:ReactiveUserControl>
|
||||||
|
@ -39,9 +39,11 @@ namespace Wabbajack
|
|||||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||||
.BindToStrict(this, x => x.BeginButton.Command)
|
.BindToStrict(this, x => x.BeginButton.Command)
|
||||||
.DisposeWith(dispose);
|
.DisposeWith(dispose);
|
||||||
|
this.BindStrict(ViewModel, vm => vm.OverwriteFiles, x => x.OverwriteCheckBox.IsChecked)
|
||||||
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
// Error handling
|
// Error handling
|
||||||
|
|
||||||
this.WhenAnyValue(x => x.ViewModel.ErrorState)
|
this.WhenAnyValue(x => x.ViewModel.ErrorState)
|
||||||
.Select(v => !v.Failed)
|
.Select(v => !v.Failed)
|
||||||
.BindToStrict(this, view => view.BeginButton.IsEnabled)
|
.BindToStrict(this, view => view.BeginButton.IsEnabled)
|
||||||
|
Loading…
Reference in New Issue
Block a user