Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional UI changes to help user confusion and information #2374

Closed
wants to merge 9 commits into from
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### Changelog

### Version - TBA
* Fixed some UI issues arising from 3.2.0.0 changes - more informative error text, drive space checking, wiki link button

#### Version - 3.2.0.0 - 7/16/2023
* Fixed issues related to high RAM usage
* The resumable downloads now reserve drive space to write to in advance instead of being managed in system RAM
Expand Down
52 changes: 48 additions & 4 deletions Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
// Command properties
public ReactiveCommand<Unit, Unit> ShowManifestCommand { get; }
public ReactiveCommand<Unit, Unit> OpenReadmeCommand { get; }
public ReactiveCommand<Unit, Unit> OpenWikiCommand { get; }
public ReactiveCommand<Unit, Unit> OpenDiscordButton { get; }
public ReactiveCommand<Unit, Unit> VisitModListWebsiteCommand { get; }

Expand Down Expand Up @@ -178,6 +179,11 @@ public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsMana
UIUtils.OpenWebsite(new Uri(ModList!.Readme));
}, this.WhenAnyValue(vm => vm.LoadingLock.IsNotLoading, vm => vm.ModList.Readme, (isNotLoading, readme) => isNotLoading && !string.IsNullOrWhiteSpace(readme)));

OpenWikiCommand = ReactiveCommand.Create(() =>
{
UIUtils.OpenWebsite(new Uri("https://wiki.wabbajack.org/index.html"));
}, this.WhenAnyValue(vm => vm.LoadingLock.IsNotLoading));

VisitModListWebsiteCommand = ReactiveCommand.Create(() =>
{
UIUtils.OpenWebsite(ModList!.Website);
Expand Down Expand Up @@ -280,6 +286,10 @@ private IEnumerable<ErrorResponse> Validate()
{
yield return ErrorResponse.Fail("Can't have identical install and download folders");
}
if (installPath.ToString().Length > 0 && downloadPath.ToString().Length > 0 && KnownFolders.IsSubDirectoryOf(installPath.ToString(), downloadPath.ToString()))
{
yield return ErrorResponse.Fail("Can't put the install folder inside the download folder");
}
foreach (var game in GameRegistry.Games)
{
if (!_gameLocator.TryFindLocation(game.Key, out var location))
Expand All @@ -305,11 +315,12 @@ private IEnumerable<ErrorResponse> Validate()
}

if (installPath.ToString().Length != 0 && installPath != LastInstallPath &&
!Installer.AutomaticallyOverwrite &&
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
{
string message =
"There are existing files in the chosen install path, they will be deleted or overwritten (if updating existing modlist), continue?";
"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);
Expand All @@ -325,10 +336,43 @@ private IEnumerable<ErrorResponse> Validate()

if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
{
yield return ErrorResponse.Fail("Can't install a modlist into Windows protected locations - such as Downloads, Documents etc");
yield return ErrorResponse.Fail("Can't install into Windows locations such as Documents etc, please make a new folder for the modlist - C:\Wabbajack\ for example.");
JanuarySnow marked this conversation as resolved.
Show resolved Hide resolved
}

if (installPath.ToString().Length > 0 && downloadPath.ToString().Length > 0 && !HasEnoughSpace(installPath, downloadPath)){
yield return ErrorResponse.Fail("Can't install modlist due to lack of free hard drive space, please read the modlist Readme to learn more.");
}
}

private bool HasEnoughSpace(AbsolutePath inpath, AbsolutePath downpath)
{
string driveLetterInPath = inpath.ToString().Substring(0,1);
string driveLetterDownPath = inpath.ToString().Substring(0,1);
DriveInfo driveUsedInPath = new DriveInfo(driveLetterInPath);
DriveInfo driveUsedDownPath = new DriveInfo(driveLetterDownPath);
long spaceRequiredforInstall = ModlistMetadata.DownloadMetadata.SizeOfInstalledFiles;
long spaceRequiredforDownload = ModlistMetadata.DownloadMetadata.SizeOfArchives;
long spaceInstRemaining = driveUsedInPath.AvailableFreeSpace;
long spaceDownRemaining = driveUsedDownPath.AvailableFreeSpace;
if ( driveLetterInPath == driveLetterDownPath)
{
long totalSpaceRequired = spaceRequiredforInstall + spaceRequiredforDownload;
if (spaceInstRemaining < totalSpaceRequired)
{
return false;
}

} else
{
if( spaceInstRemaining < spaceRequiredforInstall || spaceDownRemaining < spaceRequiredforDownload)
{
return false;
}
}
return true;

}

private async Task BeginSlideShow(CancellationToken token)
{
while (!token.IsCancellationRequested)
Expand Down Expand Up @@ -551,4 +595,4 @@ private async Task PopulateNextModSlide(ModList modList)
}
}

}
}
4 changes: 0 additions & 4 deletions Wabbajack.App.Wpf/View Models/Installers/MO2InstallerVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public class MO2InstallerVM : ViewModel, ISubInstallerVM

public bool SupportsAfterInstallNavigation => true;

[Reactive]
public bool AutomaticallyOverwrite { get; set; }

public int ConfigVisualVerticalOffset => 25;

public MO2InstallerVM(InstallerVM installerVM)
Expand Down Expand Up @@ -166,7 +163,6 @@ private void SaveSettings(Mo2ModlistInstallationSettings settings)
if (settings == null) return;
settings.InstallationLocation = Location.TargetPath;
settings.DownloadLocation = DownloadLocation.TargetPath;
settings.AutomaticallyOverrideExistingInstall = AutomaticallyOverwrite;
}

public void AfterInstallNavigation()
Expand Down
30 changes: 27 additions & 3 deletions Wabbajack.App.Wpf/Views/Installers/InstallationCompleteView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
x:TypeArguments="local:InstallerVM"
mc:Ignorable="d">
<local:AttentionBorder x:Name="AttentionBorder" ClipToBounds="True">
<Grid Margin="5">
<Grid Margin="6">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3*" />
Expand All @@ -23,6 +23,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5"
x:Name="TitleText"
Expand Down Expand Up @@ -124,11 +125,34 @@
<TextBlock Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Text="Readme" />
Text="Modlist Readme" />
</Grid>
<Grid Grid.Row="1" Grid.Column="4"
VerticalAlignment="Center"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button
x:Name="OpenWikiButton"
Width="50"
Height="50"
Style="{StaticResource CircleButtonStyle}">
<icon:PackIconFontAwesome
Width="25"
Height="25"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
Kind="QuestionSolid" />
</Button>
<TextBlock Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Text="Help and Wiki" />
</Grid>
<Grid Grid.Row="1" Grid.Column="5"
VerticalAlignment="Center"
Background="Transparent">
Background="Transparent" Grid.ColumnSpan="2" Margin="0,0,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public InstallationCompleteView()
this.WhenAny(x => x.ViewModel.OpenReadmeCommand)
.BindToStrict(this, x => x.OpenReadmeButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.OpenWikiCommand)
.BindToStrict(this, x => x.OpenWikiButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.CloseWhenCompleteCommand)
.BindToStrict(this, x => x.CloseButton.Command)
.DisposeWith(dispose);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
FontSize="14"
Text="Target Modlist"
TextAlignment="Center" />
<TextBlock x:Name="errorTextBox"
Grid.Row="3"
FontFamily="Verdana" FontSize="10" FontWeight="ExtraBold"
Background="{StaticResource WindowBackgroundBrush}"
Foreground="Red"
Text=""
TextAlignment="Left" Margin="0,79,0,-45" Grid.ColumnSpan="3" />
<local:FilePicker Grid.Row="1" Grid.Column="2"
x:Name="ModListLocationPicker"
Height="30"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public InstallationConfigurationView()
.Select(v => !v.Failed)
.BindToStrict(this, view => view.BeginButton.IsEnabled)
.DisposeWith(dispose);


this.WhenAnyValue(x => x.ViewModel.ErrorState)
.Select(v => v.Reason)
.BindToStrict(this, view => view.errorTextBox.Text)
.DisposeWith(dispose);

this.WhenAnyValue(x => x.ViewModel.ErrorState)
.Select(v => v.Failed ? Visibility.Visible : Visibility.Hidden)
.BindToStrict(this, view => view.ErrorSummaryIcon.Visibility)
Expand Down
16 changes: 0 additions & 16 deletions Wabbajack.App.Wpf/Views/Installers/MO2InstallerConfigView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,5 @@
FontSize="14"
PickerVM="{Binding DownloadLocation}"
ToolTip="The directory where modlist archives will be downloaded to" />
<CheckBox Grid.Row="2" 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>
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
x:Name="ExtendedDescription"
TextWrapping="WrapWithOverflow" />
<CheckBox Grid.Row="2" Grid.Column="2"
x:Name="AutoOverwriteCheckbox"
Margin="4"
HorizontalAlignment="Right"
Content="Remember"
IsChecked="{Binding Installer.AutomaticallyOverwrite}"
ToolTip="If installing over an existing installation next time, automatically replace it without asking permission." />
<Button Grid.Row="3" Grid.Column="0"
x:Name="CancelButton"
Content="Cancel" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ public ConfirmUpdateOfExistingInstallView()
this.WhenAny(x => x.ViewModel.Source.CancelCommand)
.BindToStrict(this, x => x.CancelButton.Command)
.DisposeWith(dispose);

this.BindStrict(this.ViewModel, x => x.Installer.AutomaticallyOverwrite, x => x.AutoOverwriteCheckbox.IsChecked,
vmToViewConverter: x => x,
viewToVmConverter: x => x ?? false)
.DisposeWith(dispose);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion Wabbajack.Launcher/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private async Task VerifyCurrentLocation()
ShowInCenter = true,
ContentTitle = "Wabbajack Launcher: Bad startup path",
ContentMessage =
"Cannot start in the root of a drive, or protected folder locations such as Downloads, Desktop etc.\nPlease move Wabbajack to another folder."
"Cannot start in the root of a drive, or protected folder locations such as Downloads, Desktop etc.\nPlease move Wabbajack to another folder, creating a new folder if necessary ( example : C:\\Wabbajack\\, outside of these locations."
});
var result = await msg.Show();
Environment.Exit(1);
Expand Down