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 exception on clicking Play before dropdown appears #4028

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions GUI/Controls/ManageMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
{
get
{
var configuration = Main.Instance.configuration;

Check warning on line 91 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (latest, Debug)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

Check warning on line 91 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (6.8, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

Check warning on line 91 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (latest, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

Check warning on line 91 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (6.12, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'
// Make sure we don't return any column the GUI doesn't know about.
var unknownCols = configuration.SortColumns.Where(col => !ModGrid.Columns.Contains(col)).ToList();
foreach (var unknownCol in unknownCols)
Expand All @@ -101,7 +101,7 @@
}
}

private List<bool> descending => Main.Instance.configuration.MultiSortDescending;

Check warning on line 104 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (latest, Debug)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

Check warning on line 104 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (6.8, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

Check warning on line 104 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (6.12, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'

public event Action<GUIMod> OnSelectedModuleChanged;
public event Action<List<ModChange>, Dictionary<GUIMod, string>> OnChangeSetChanged;
Expand Down Expand Up @@ -189,7 +189,7 @@
ClearStatusBar?.Invoke();
}

var inst = Main.Instance.CurrentInstance;

Check warning on line 192 in GUI/Controls/ManageMods.cs

View workflow job for this annotation

GitHub Actions / build (6.12, Release)

'Main.Instance' is obsolete: 'Main.Instance is a global singleton. Find a better way to access this object.'
var registry = RegistryManager.Instance(inst, repoData).registry;
if (prevConflicts != null)
{
Expand Down Expand Up @@ -554,8 +554,6 @@
private void LaunchGameToolStripMenuItem_MouseHover(object sender, EventArgs e)
{
var cmdLines = Main.Instance.configuration.CommandLines;
LaunchGameToolStripMenuItem.Tag =
LaunchGameToolStripMenuItem.ToolTipText = cmdLines.First();
LaunchGameToolStripMenuItem.DropDownItems.Clear();
LaunchGameToolStripMenuItem.DropDownItems.AddRange(
cmdLines.Select(cmdLine => (ToolStripItem)
Expand Down
8 changes: 6 additions & 2 deletions GUI/Main/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,11 +937,15 @@ private void openGameDirectoryToolStripMenuItem_Click(object sender, EventArgs e

private void openGameToolStripMenuItem_Click(object sender, EventArgs e)
{
LaunchGame(configuration.CommandLines.First());
LaunchGame();
}

private void LaunchGame(string command)
private void LaunchGame(string command = null)
{
if (string.IsNullOrEmpty(command))
{
command = configuration.CommandLines.First();
}
var split = command.Split(' ');
if (split.Length == 0)
{
Expand Down
Loading