Skip to content

Commit

Permalink
Fix missing mod info tab alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 29, 2022
1 parent e86ae35 commit d9aab2f
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 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 @@ -182,6 +183,19 @@ private void UpdateHeaderInfo(CkanModule module)
? ScrollBars.None
: ScrollBars.Vertical;
});
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 (gmod.IsIncompatible)
{
var pageToAlert = module.IsCompatibleKSP(crit) ? RelationshipTabPage : AllModVersionsTabPage;
pageToAlert.Text = fakeStopSign + pageToAlert.Text;
}
});
}

private void UpdateModInfo(GUIMod gui_module)
Expand Down Expand Up @@ -211,25 +225,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

0 comments on commit d9aab2f

Please sign in to comment.