Create and use MainForm.ShowDialogAsChild(Form) helper

This commit is contained in:
YoshiRulz 2020-06-17 09:22:05 +10:00
parent 0e767add09
commit 77e6a7300a
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
7 changed files with 10 additions and 8 deletions

View File

@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
}
dlg.checkBoxASync.Checked = audioSync;
DialogResult result = dlg.ShowDialog(owner);
var result = owner.ShowDialogAsChild(dlg);
IVideoWriter ret;

View File

@ -3460,7 +3460,7 @@ namespace BizHawk.Client.EmuHawk
private int? LoadArchiveChooser(HawkFile file)
{
using var ac = new ArchiveChooser(file);
if (ac.ShowDialog(this) == DialogResult.OK)
if (ShowDialogAsChild(ac) == DialogResult.OK)
{
return ac.SelectedMemberIndex;
}
@ -4478,5 +4478,7 @@ namespace BizHawk.Client.EmuHawk
return isRewinding;
}
public DialogResult ShowDialogAsChild(Form dialog) => dialog.ShowDialog(this);
}
}

View File

@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
dlg.gbPrefControl1.ColorGameBoy = emu.IsCGBMode(false);
dlg.gbPrefControl2.ColorGameBoy = emu.IsCGBMode(true);
if (dlg.ShowDialog(mainForm) == DialogResult.OK)
if (mainForm.ShowDialogAsChild(dlg) == DialogResult.OK)
{
dlg.GetSettings(out s, out ss);
gambatte.PutSettings(s);

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
using var dlg = new GBPrefs();
dlg.gbPrefControl1.PutSettings(s, ss);
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode();
if (dlg.ShowDialog(mainForm) == DialogResult.OK)
if (mainForm.ShowDialogAsChild(dlg) == DialogResult.OK)
{
dlg.gbPrefControl1.GetSettings(out s, out ss);
gb.PutSettings(s);

View File

@ -127,14 +127,14 @@ namespace BizHawk.Client.EmuHawk
else
{
using var dlg = new GenericCoreConfig(owner) { Text = title };
dlg.ShowDialog(owner);
owner.ShowDialogAsChild(dlg);
}
}
public static void DoDialog(MainForm owner, string title, bool hideSettings, bool hideSyncSettings)
{
using var dlg = new GenericCoreConfig(owner, hideSettings, hideSyncSettings) { Text = title };
dlg.ShowDialog(owner);
owner.ShowDialogAsChild(dlg);
}
private void PropertyGrid2_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{

View File

@ -84,7 +84,7 @@ namespace BizHawk.Client.EmuHawk
var size = psx.CurrentVideoSize;
using var dlg = new PSXOptions(mainForm, config, s, ss, vid, size);
var result = dlg.ShowDialog(mainForm);
var result = mainForm.ShowDialogAsChild(dlg);
return result;
}

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
ShowBg4 = s.ShowBG4_0
};
var result = dlg.ShowDialog(mainForm);
var result = mainForm.ShowDialogAsChild(dlg);
if (result == DialogResult.OK)
{
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;