Ensure owner param of ShowHawkDialog overloads are never null

This commit is contained in:
YoshiRulz 2020-12-01 04:04:10 +10:00 committed by James Groom
parent aad612593b
commit dd44ff7f6c
3 changed files with 5 additions and 9 deletions

View File

@ -148,7 +148,7 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Handles EmuHawk specific issues before showing a modal dialog
/// </summary>
public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner = null, Point position = default)
public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner, Point position = default)
{
Sound.Instance.StopSound();
if (position != default)
@ -156,7 +156,7 @@ namespace BizHawk.Client.EmuHawk
form.StartPosition = FormStartPosition.Manual;
form.Location = position;
}
var result = (owner == null ? form.ShowDialog(new Form { TopMost = true }) : form.ShowDialog(owner));
var result = form.ShowDialog(owner);
Sound.Instance.StartSound();
return result;
}
@ -167,11 +167,7 @@ namespace BizHawk.Client.EmuHawk
public static DialogResult ShowHawkDialog(this CommonDialog form, IWin32Window owner)
{
Sound.Instance.StopSound();
DialogResult result;
if(owner != null)
result = form.ShowDialog(owner);
else
result = form.ShowDialog();
var result = form.ShowDialog(owner);
Sound.Instance.StartSound();
return result;
}

View File

@ -150,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
Config.PathEntries.CheatsAbsolutePath(Game.System),
"Cheat Files",
"cht",
Owner);
Owner ?? this);
return file != null && MainForm.CheatList.SaveFile(file.FullName);
}

View File

@ -426,7 +426,7 @@ namespace BizHawk.Client.EmuHawk
TextInputType = InputPrompt.InputType.Text
};
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog());
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog(this));
if (result == DialogResult.OK)
{