Cleanup MainForm interfaces, move ShowDialogAsChild to extension
This commit is contained in:
parent
f0664ce018
commit
8a6c7be6aa
|
@ -159,6 +159,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
dialogController.StartSound();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static DialogResult ShowDialogAsChild(this IDialogParent dialogParent, Form dialog)
|
||||
=> dialog.ShowDialog(dialogParent.SelfAsHandle);
|
||||
}
|
||||
|
||||
public static class ListViewExtensions
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#nullable enable
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IDialogController
|
||||
{
|
||||
DialogResult ShowDialogAsChild(Form dialog);
|
||||
|
||||
void StartSound();
|
||||
|
||||
void StopSound();
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IMainFormForConfig : IDialogController
|
||||
public interface IMainFormForConfig : IDialogController, IDialogParent
|
||||
{
|
||||
/// <remarks>only referenced from <see cref="GenericCoreConfig"/></remarks>
|
||||
IEmulator Emulator { get; }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
using BizHawk.Client.Common;
|
||||
|
@ -7,7 +6,7 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IMainFormForTools : IDialogController
|
||||
public interface IMainFormForTools : IDialogController, IDialogParent
|
||||
{
|
||||
CheatCollection CheatList { get; }
|
||||
|
||||
|
|
|
@ -3464,7 +3464,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int? LoadArchiveChooser(HawkFile file)
|
||||
{
|
||||
using var ac = new ArchiveChooser(file);
|
||||
if (ShowDialogAsChild(ac).IsOk())
|
||||
if (this.ShowDialogAsChild(ac).IsOk())
|
||||
{
|
||||
return ac.SelectedMemberIndex;
|
||||
}
|
||||
|
@ -4495,8 +4495,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public IWin32Window SelfAsHandle => this;
|
||||
|
||||
public DialogResult ShowDialogAsChild(Form dialog) => dialog.ShowDialog(this);
|
||||
|
||||
public void StartSound() => Sound.StartSound();
|
||||
public void StopSound() => Sound.StopSound();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue