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

Fix missing mod info tab alerts #3649

Merged
merged 1 commit into from
Aug 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions GUI/Controls/ModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public GUIMod SelectedModule
{
ReverseRelationshipsCheckbox.CheckState = CheckState.Unchecked;
}
UpdateHeaderInfo(module);
UpdateHeaderInfo(value, manager.CurrentInstance.VersionCriteria());
LoadTab(ModInfoTabControl.SelectedTab.Name, value);
}
selectedModule = value;
Expand Down Expand Up @@ -168,8 +168,9 @@ private void LinkLabel_KeyDown(object sender, KeyEventArgs e)
}
}

private void UpdateHeaderInfo(CkanModule module)
private void UpdateHeaderInfo(GUIMod gmod, GameVersionCriteria crit)
{
var module = gmod.ToModule();
Util.Invoke(this, () =>
{
MetadataModuleNameTextBox.Text = module.name;
Expand All @@ -181,6 +182,16 @@ private void UpdateHeaderInfo(CkanModule module)
string.IsNullOrWhiteSpace(module.description)
? ScrollBars.None
: ScrollBars.Vertical;
// Mono doesn't draw TabPage.ImageIndex, so fake it
const string fakeStopSign = "<!> ";
ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(ModInfo));
resources.ApplyResources(RelationshipTabPage, "RelationshipTabPage");
resources.ApplyResources(AllModVersionsTabPage, "AllModVersionsTabPage");
if (gmod.IsIncompatible)
{
var pageToAlert = module.IsCompatibleKSP(crit) ? RelationshipTabPage : AllModVersionsTabPage;
pageToAlert.Text = fakeStopSign + pageToAlert.Text;
}
});
}

Expand Down Expand Up @@ -211,25 +222,6 @@ private void UpdateModInfo(GUIMod gui_module)
});
Util.Invoke(MetadataModuleGameCompatibilityTextBox, () => MetadataModuleGameCompatibilityTextBox.Text = gui_module.GameCompatibilityLong);

Util.Invoke(ModInfoTabControl, () =>
{
// Mono doesn't draw TabPage.ImageIndex, so fake it
const string fakeStopSign = "<!> ";
ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(ModInfo));
resources.ApplyResources(RelationshipTabPage, "RelationshipTabPage");
resources.ApplyResources(AllModVersionsTabPage, "AllModVersionsTabPage");
if (gui_module.IsIncompatible)
{
if (!module.IsCompatibleKSP(manager.CurrentInstance.VersionCriteria()))
{
AllModVersionsTabPage.Text = fakeStopSign + AllModVersionsTabPage.Text;
}
else
{
RelationshipTabPage.Text = fakeStopSign + RelationshipTabPage.Text;
}
}
});
Util.Invoke(ReplacementTextBox, () =>
{
if (module.replaced_by == null)
Expand Down