Skip to content

Commit

Permalink
Merge #4302 Make versions tab non-interactive inside install flow
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 7, 2025
2 parents 8ea7868 + 4033929 commit 8ec3b2c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
- [Core] Handle missing indexes in Steam vdf file lists (#4279 by: HebaruSan)
- [Core] Fix cloning instances with shared stock files on Windows (#4297 by: HebaruSan)
- [Core] Handle paths without DriveInfo (#4300 by: HebaruSan)
- [GUI] Make versions tab non-interactive inside install flow (#4302 by: HebaruSan)

### Internal

Expand Down
11 changes: 7 additions & 4 deletions GUI/Controls/ModInfoTabs/Versions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public GUIMod? SelectedModule
private static GameInstance? currentInstance => Main.Instance?.CurrentInstance;
private static GameInstanceManager? manager => Main.Instance?.Manager;
private static IUser? user => Main.Instance?.currentUser;
private static bool interactive => !Main.Instance?.Waiting ?? false;

private readonly RepositoryDataManager repoData;
private GUIMod? visibleGuiModule;
Expand Down Expand Up @@ -171,7 +172,7 @@ private void visibleGuiModule_PropertyChanged(object? sender, PropertyChangedEve

private void UpdateSelection()
{
if (visibleGuiModule != null)
if (visibleGuiModule != null && interactive)
{
bool prevIgnore = ignoreItemCheck;
ignoreItemCheck = true;
Expand Down Expand Up @@ -256,7 +257,7 @@ private ListViewItem[] getItems(GUIMod gmod, List<CkanModule> versions)
{
toRet.BackColor = PrereleaseLabel.BackColor;
}
if (module.Equals(gmod.SelectedMod))
if (module.Equals(gmod.SelectedMod) && interactive)
{
toRet.Checked = true;
}
Expand Down Expand Up @@ -322,6 +323,8 @@ private void Refresh(GUIMod gmod)
{
if (currentInstance != null)
{
StabilityToleranceLabel.Visible = interactive;
StabilityToleranceComboBox.Visible = interactive;
// checkInstallable needs this to stop background threads on switch to another mod
cancelTokenSrc = new CancellationTokenSource();
var startingModule = gmod;
Expand All @@ -342,7 +345,7 @@ private void Refresh(GUIMod gmod)
if (startingModule.Equals(visibleGuiModule))
{
// Only show checkboxes for non-DLC modules
VersionsListView.CheckBoxes = !gmod.ToModule().IsDLC;
VersionsListView.CheckBoxes = interactive && !gmod.ToModule().IsDLC;
ignoreItemCheck = true;
VersionsListView.Items.AddRange(items);
VersionsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
Expand All @@ -359,7 +362,7 @@ private void Refresh(GUIMod gmod)

private void UpdateStabilityToleranceComboBox(GUIMod gmod)
{
if (currentInstance != null)
if (currentInstance != null && interactive)
{
StabilityToleranceComboBox.Items.Clear();
StabilityToleranceComboBox.Items.AddRange(
Expand Down
2 changes: 2 additions & 0 deletions GUI/Controls/Wait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public void StartWaiting(Action<object?, DoWorkEventArgs?> mainWork,
public event Action? OnCancel;
public event Action? OnOk;

public bool Busy => bgWorker.IsBusy;

#pragma warning disable IDE0027

public bool RetryEnabled
Expand Down
1 change: 1 addition & 0 deletions GUI/Main/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public partial class Main : Form, IMessageFilter
private readonly RepositoryDataManager repoData;
private readonly string? userAgent;
private readonly AutoUpdate updater = new AutoUpdate();
public bool Waiting => Wait.Busy;

// Stuff we set when the game instance changes
public GUIConfiguration? configuration;
Expand Down

0 comments on commit 8ec3b2c

Please sign in to comment.