Encapsulate MessageBox.Show using IDialogController and some helpers
a lot of the calls to `DialogController.ShowMessageBox` from `ToolFormBase` inheritors could be replaced with `this.ModalMessageBox` (i.e. add self as parent window)
This commit is contained in:
parent
9cafddb1e0
commit
96f9e8f6e4
|
@ -143,6 +143,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
public static class FormExtensions
|
||||
{
|
||||
public static void DoWithTempMute(this IDialogController dialogController, Action action)
|
||||
|
@ -160,6 +161,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="MessageBox"/> with the receiver (<paramref name="dialogParent"/>) as its parent, with the given <paramref name="text"/>,
|
||||
/// and with the given <paramref name="caption"/>, <paramref name="buttons"/>, and <paramref name="icon"/> if they're specified.
|
||||
/// </summary>
|
||||
public static DialogResult ModalMessageBox(
|
||||
this IDialogParent dialogParent,
|
||||
string text,
|
||||
string? caption = null,
|
||||
MessageBoxButtons? buttons = null,
|
||||
MessageBoxIcon? icon = null)
|
||||
=> dialogParent.DialogController.ShowMessageBox(
|
||||
owner: dialogParent,
|
||||
text: text,
|
||||
caption: caption,
|
||||
buttons: buttons,
|
||||
icon: icon);
|
||||
|
||||
public static DialogResult ShowDialogAsChild(this IDialogParent dialogParent, CommonDialog dialog)
|
||||
=> dialog.ShowDialog(dialogParent.SelfAsHandle);
|
||||
|
||||
|
@ -171,7 +189,25 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static DialogResult ShowDialogWithTempMute(this IDialogParent dialogParent, Form dialog)
|
||||
=> dialogParent.DialogController.DoWithTempMute(() => dialog.ShowDialog(dialogParent.SelfAsHandle));
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="MessageBox"/> without a parent, with the given <paramref name="text"/>,
|
||||
/// and with the given <paramref name="caption"/>, <paramref name="buttons"/>, and <paramref name="icon"/> if they're specified.
|
||||
/// </summary>
|
||||
public static DialogResult ShowMessageBox(
|
||||
this IDialogController dialogController,
|
||||
string text,
|
||||
string? caption = null,
|
||||
MessageBoxButtons? buttons = null,
|
||||
MessageBoxIcon? icon = null)
|
||||
=> dialogController.ShowMessageBox(
|
||||
owner: null,
|
||||
text: text,
|
||||
caption: caption,
|
||||
buttons: buttons,
|
||||
icon: icon);
|
||||
}
|
||||
#nullable restore
|
||||
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
|
|
|
@ -218,7 +218,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
|
|||
{
|
||||
if (recent.Frozen)
|
||||
{
|
||||
MessageBox.Show($"Could not open {path}", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
mainForm.ShowMessageBox($"Could not open {path}", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
#nullable enable
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IDialogController
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="MessageBox"/> with the given <paramref name="text"/>,
|
||||
/// and with the given <paramref name="owner"/>, <paramref name="caption"/>, <paramref name="buttons"/>, and <paramref name="icon"/> if they're specified.
|
||||
/// </summary>
|
||||
DialogResult ShowMessageBox(
|
||||
IDialogParent? owner,
|
||||
string text,
|
||||
string? caption = null,
|
||||
MessageBoxButtons? buttons = null,
|
||||
MessageBoxIcon? icon = null);
|
||||
|
||||
void StartSound();
|
||||
|
||||
void StopSound();
|
||||
|
|
|
@ -391,12 +391,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!Emulator.Attributes().Released)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
this,
|
||||
"Thanks for using BizHawk! The emulation core you have selected " +
|
||||
"is currently BETA-status. We appreciate your help in testing BizHawk. " +
|
||||
"You can record a movie on this core if you'd like to, but expect to " +
|
||||
"encounter bugs and sync problems. Continue?", "BizHawk", MessageBoxButtons.YesNo);
|
||||
var result = this.ModalMessageBox(
|
||||
"Thanks for using BizHawk! The emulation core you have selected "
|
||||
+ "is currently BETA-status. We appreciate your help in testing BizHawk. "
|
||||
+ "You can record a movie on this core if you'd like to, but expect to "
|
||||
+ "encounter bugs and sync problems. Continue?",
|
||||
"BizHawk",
|
||||
MessageBoxButtons.YesNo);
|
||||
|
||||
if (result != DialogResult.Yes)
|
||||
{
|
||||
|
@ -1230,7 +1231,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!Emulator.CanPollInput())
|
||||
{
|
||||
MessageBox.Show("Current core does not support input polling. TAStudio can't be used.");
|
||||
ShowMessageBox(owner: null, "Current core does not support input polling. TAStudio can't be used.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1509,8 +1510,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
var message =
|
||||
$"Invalid file format. Reason: {ex.Message} \nForce transfer? This may cause the calculator to crash.";
|
||||
|
||||
if (MessageBox.Show(message, "Upload Failed", MessageBoxButtons.YesNoCancel,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (ShowMessageBox(
|
||||
owner: null,
|
||||
message,
|
||||
"Upload Failed",
|
||||
MessageBoxButtons.YesNoCancel,
|
||||
MessageBoxIcon.Question)
|
||||
== DialogResult.Yes)
|
||||
{
|
||||
ti83.LinkPort.SendFileToCalc(File.OpenRead(ofd.FileName), false);
|
||||
}
|
||||
|
@ -2459,9 +2465,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void UpdateNotification_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sound.StopSound();
|
||||
DialogResult result = MessageBox.Show(this,
|
||||
var result = this.ModalMessageBox(
|
||||
$"Version {Config.UpdateLatestVersion} is now available. Would you like to open the BizHawk homepage?\r\n\r\nClick \"No\" to hide the update notification for this version.",
|
||||
"New Version Available", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
"New Version Available",
|
||||
MessageBoxButtons.YesNoCancel,
|
||||
MessageBoxIcon.Question);
|
||||
Sound.StartSound();
|
||||
|
||||
if (result == DialogResult.Yes)
|
||||
|
@ -2593,7 +2601,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Exception on drag and drop:\n{ex}");
|
||||
ShowMessageBox(owner: null, $"Exception on drag and drop:\n{ex}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -339,7 +339,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (ArgParser.ArgParserException e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
ShowMessageBox(owner: null, e.Message);
|
||||
}
|
||||
|
||||
// TODO GL - a lot of disorganized wiring-up here
|
||||
|
@ -443,7 +443,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
message = "Couldn't initialize DirectSound! Things may go poorly for you. Try changing your sound driver to 44.1khz instead of 48khz in mmsys.cpl.";
|
||||
}
|
||||
|
||||
MessageBox.Show(message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
ShowMessageBox(owner: null, message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
Config.SoundOutputMethod = ESoundOutputMethod.Dummy;
|
||||
Sound = new Sound(Handle, Config, Emulator.VsyncRate);
|
||||
|
@ -478,7 +478,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadRom(_argParser.cmdRom, new LoadRomArgs { OpenAdvanced = ioa });
|
||||
if (Game == null)
|
||||
{
|
||||
MessageBox.Show($"Failed to load {_argParser.cmdRom} specified on commandline");
|
||||
ShowMessageBox(owner: null, $"Failed to load {_argParser.cmdRom} specified on commandline");
|
||||
}
|
||||
}
|
||||
else if (Config.RecentRoms.AutoLoad && !Config.RecentRoms.Empty)
|
||||
|
@ -1771,7 +1771,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// we're eating this one now. The possible negative consequence is that a user could lose
|
||||
// their saveram and not know why
|
||||
// MessageBox.Show("Error: tried to load saveram, but core would not accept it?");
|
||||
// ShowMessageBox(owner: null, "Error: tried to load saveram, but core would not accept it?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2288,11 +2288,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
// Only show this nag if the core actually has sync settings, not all cores do
|
||||
if (e.Settings != null && !_suppressSyncSettingsWarning)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"No sync settings found, using currently configured settings for this core.",
|
||||
"No sync settings found",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
ShowMessageBox(
|
||||
owner: null,
|
||||
"No sync settings found, using currently configured settings for this core.",
|
||||
"No sync settings found",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3443,7 +3444,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show($"Video dumping died:\n\n{e}");
|
||||
ShowMessageBox(owner: null, $"Video dumping died:\n\n{e}");
|
||||
AbortAv();
|
||||
}
|
||||
}
|
||||
|
@ -3496,14 +3497,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ShowMessageCoreComm(string message)
|
||||
{
|
||||
MessageBox.Show(this, message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
this.ModalMessageBox(message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
private void ShowLoadError(object sender, RomLoader.RomErrorArgs e)
|
||||
{
|
||||
if (e.Type == RomLoader.LoadErrorType.MissingFirmware)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
var result = ShowMessageBox(
|
||||
owner: null,
|
||||
"You are missing the needed firmware files to load this Rom\n\nWould you like to open the firmware manager now and configure your firmwares?",
|
||||
e.Message,
|
||||
MessageBoxButtons.YesNo,
|
||||
|
@ -3528,7 +3530,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
title = $"{e.AttemptedCoreLoad} load error";
|
||||
}
|
||||
|
||||
MessageBox.Show(this, e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
this.ModalMessageBox(e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3893,8 +3895,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!FlushSaveRAM())
|
||||
{
|
||||
var msgRes = MessageBox.Show("Failed flushing the game's Save RAM to your disk.\nClose without flushing Save RAM?",
|
||||
"Directory IO Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
|
||||
var msgRes = ShowMessageBox(
|
||||
owner: null,
|
||||
"Failed flushing the game's Save RAM to your disk.\nClose without flushing Save RAM?",
|
||||
"Directory IO Error",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Error);
|
||||
|
||||
if (msgRes != DialogResult.Yes)
|
||||
{
|
||||
|
@ -3955,7 +3961,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (result.Errors.Any())
|
||||
{
|
||||
MessageBox.Show(string.Join("\n", result.Errors), "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
ShowMessageBox(owner: null, string.Join("\n", result.Errors), "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
if (result.Warnings.Any())
|
||||
|
@ -4491,6 +4497,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public IWin32Window SelfAsHandle => this;
|
||||
|
||||
public DialogResult ShowMessageBox(
|
||||
IDialogParent/*?*/ owner,
|
||||
string text,
|
||||
string/*?*/ caption = null,
|
||||
MessageBoxButtons? buttons = null,
|
||||
MessageBoxIcon? icon = null)
|
||||
=> MessageBox.Show(
|
||||
owner?.SelfAsHandle,
|
||||
text,
|
||||
caption ?? string.Empty,
|
||||
buttons ?? MessageBoxButtons.OK,
|
||||
icon ?? MessageBoxIcon.None);
|
||||
|
||||
public void StartSound() => Sound.StartSound();
|
||||
public void StopSound() => Sound.StopSound();
|
||||
}
|
||||
|
|
|
@ -907,7 +907,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var message = CanStart();
|
||||
if (!string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
MessageBox.Show(message);
|
||||
DialogController.ShowMessageBox(message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// TODO - I don't like this system. It's hard to figure out how to use it. It should be done in multiple passes.
|
||||
var result = MessageBox.Show("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
var result = DialogController.ShowMessageBox("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.No)
|
||||
{
|
||||
ShutdownCDL();
|
||||
|
@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (!newCDL.Check(testCDL))
|
||||
{
|
||||
if(!_autoloading)
|
||||
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
|
||||
this.ModalMessageBox("CDL file does not match emulator's current memory map!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//take care not to clobber an existing CDL
|
||||
if (_cdl != null)
|
||||
{
|
||||
var result = MessageBox.Show(this, "OK to create new CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
var result = this.ModalMessageBox("OK to create new CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
if (result != DialogResult.Yes)
|
||||
return;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//take care not to clobber an existing CDL
|
||||
if (_cdl != null)
|
||||
{
|
||||
var result = MessageBox.Show(this, "OK to load new CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
var result = this.ModalMessageBox("OK to load new CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
if (result != DialogResult.Yes)
|
||||
return;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_cdl == null)
|
||||
{
|
||||
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
|
||||
this.ModalMessageBox("Cannot save with no CDL loaded!", "Alert");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_cdl == null)
|
||||
{
|
||||
MessageBox.Show(this, "Cannot append with no CDL loaded!", "Alert");
|
||||
this.ModalMessageBox("Cannot append with no CDL loaded!", "Alert");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
newCDL.Load(fs);
|
||||
if (!_cdl.Check(newCDL))
|
||||
{
|
||||
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
|
||||
this.ModalMessageBox("CDL file does not match emulator's current memory map!");
|
||||
return;
|
||||
}
|
||||
_cdl.LogicalOrFrom(newCDL);
|
||||
|
@ -441,11 +441,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_cdl == null)
|
||||
{
|
||||
MessageBox.Show(this, "Cannot clear with no CDL loaded!", "Alert");
|
||||
this.ModalMessageBox("Cannot clear with no CDL loaded!", "Alert");
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = MessageBox.Show(this, "OK to clear CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
var result = this.ModalMessageBox("OK to clear CDL?", "Query", MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
_cdl.ClearData();
|
||||
|
@ -458,7 +458,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_cdl == null)
|
||||
{
|
||||
MessageBox.Show(this, "Cannot disassemble with no CDL loaded!", "Alert");
|
||||
this.ModalMessageBox("Cannot disassemble with no CDL loaded!", "Alert");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(result.Error, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
DialogController.ShowMessageBox(result.Error, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
DialogController.ShowMessageBox($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void BtnClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Clear old Inputs
|
||||
var result = MessageBox.Show("Are you sure you want to clear this form?", "Clear Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
var result = DialogController.ShowMessageBox("Are you sure you want to clear this form?", "Clear Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
txtDescription.Clear();
|
||||
|
|
|
@ -1262,7 +1262,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if(!_domain.Writable)
|
||||
{
|
||||
MessageBox.Show("This Memory Domain can't be Poked; so importing can't work");
|
||||
DialogController.ShowMessageBox("This Memory Domain can't be Poked; so importing can't work");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
#if false // if needed
|
||||
MessageBox.Show(new SlimDX.Matrix {
|
||||
DialogController.ShowMessageBox(new SlimDX.Matrix {
|
||||
M11 = matVals[0, 0], M12 = matVals[0, 1], M13 = matVals[0, 2], M14 = matVals[0, 3],
|
||||
M21 = matVals[1, 0], M22 = matVals[1, 1], M23 = matVals[1, 2], M24 = matVals[1, 3],
|
||||
M31 = matVals[2, 0], M32 = matVals[2, 1], M33 = matVals[2, 2], M34 = matVals[2, 3],
|
||||
|
@ -2266,7 +2266,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var str = sw.ToString();
|
||||
MessageBox.Show(str);
|
||||
DialogController.ShowMessageBox(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
DialogController.ShowMessageBox(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.ToString());
|
||||
DialogController.ShowMessageBox(e.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -651,7 +651,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
DialogController.ShowMessageBox(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -963,7 +963,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
DialogController.ShowMessageBox(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
DialogController.ShowMessageBox(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// which resets tools before the movie session becomes active)
|
||||
if (!CurrentMovie.IsActive() && !Tools.IsLoaded<TAStudio>())
|
||||
{
|
||||
MessageBox.Show("In order to use this tool you must be recording a movie.");
|
||||
DialogController.ShowMessageBox("In order to use this tool you must be recording a movie.");
|
||||
Close();
|
||||
DialogResult = DialogResult.Cancel;
|
||||
return;
|
||||
|
@ -98,7 +98,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return true;
|
||||
}
|
||||
|
||||
DialogResult result = MessageBox.Show("You have unsaved macro(s). Do you wish to save them?", "Save?", MessageBoxButtons.YesNoCancel);
|
||||
DialogResult result = DialogController.ShowMessageBox("You have unsaved macro(s). Do you wish to save them?", "Save?", MessageBoxButtons.YesNoCancel);
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
|
@ -121,7 +121,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (StartNum.Value >= CurrentMovie.InputLogLength || EndNum.Value >= CurrentMovie.InputLogLength)
|
||||
{
|
||||
MessageBox.Show("Start and end frames must be inside the movie.");
|
||||
DialogController.ShowMessageBox("Start and end frames must be inside the movie.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedZone == null)
|
||||
{
|
||||
MessageBox.Show("Please select a zone first.");
|
||||
DialogController.ShowMessageBox("Please select a zone first.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
fileInfo = new FileInfo(NameBox.Text);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
var result = this.ModalMessageBox("File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// archive - run the archive chooser
|
||||
if (SystemString == "PSX" || SystemString == "PCFX" || SystemString == "SAT")
|
||||
{
|
||||
MessageBox.Show("Using archives with PSX, PCFX or SATURN is not currently recommended/supported.");
|
||||
DialogController.ShowMessageBox("Using archives with PSX, PCFX or SATURN is not currently recommended/supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
catch (Exception ex)
|
||||
{
|
||||
text = "";
|
||||
MessageBox.Show($"oops\n{ex}");
|
||||
DialogController.ShowMessageBox($"oops\n{ex}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (filename.EndsWith(MovieService.StandardMovieExtension))
|
||||
{
|
||||
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
var result1 = DialogController.ShowMessageBox("This is a regular movie, a new project must be created from it to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
if (result1.IsOk())
|
||||
{
|
||||
_initializing = true; // Starting a new movie causes a core reboot
|
||||
|
@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
DialogController.ShowMessageBox("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|| Emulator is Emulation.Cores.Nintendo.Gameboy.Gameboy
|
||||
|| Emulator is Emulation.Cores.Nintendo.SubGBHawk.SubGBHawk)
|
||||
{
|
||||
MessageBox.Show("This core requires emulation to be on the last frame when writing the movie, otherwise movie length will appear incorrect.\nTAStudio can't handle this, so Export BK2, play it to the end, and then Save Movie.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
DialogController.ShowMessageBox("This core requires emulation to be on the last frame when writing the movie, otherwise movie length will appear incorrect.\nTAStudio can't handle this, so Export BK2, play it to the end, and then Save Movie.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
var bk2 = CurrentTasMovie.ToBk2();
|
||||
|
@ -728,7 +728,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (TasView.SelectedRows.Count() > 50)
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you want to add more than 50 markers?", "Add markers", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
var result = DialogController.ShowMessageBox("Are you sure you want to add more than 50 markers?", "Add markers", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
|
@ -763,7 +763,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!Emulator.DeterministicEmulation)
|
||||
{
|
||||
if (MessageBox.Show("The emulator is not deterministic. It might fail even if the difference isn't enough to cause a desync.\nContinue with check?", "Not Deterministic", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
if (DialogController.ShowMessageBox("The emulator is not deterministic. It might fail even if the difference isn't enough to cause a desync.\nContinue with check?", "Not Deterministic", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (!state.SequenceEqual(greenZone))
|
||||
{
|
||||
if (MessageBox.Show($"Bad data between frames {lastState} and {Emulator.Frame}. Save the relevant state (raw data)?", "Integrity Failed!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
if (DialogController.ShowMessageBox($"Bad data between frames {lastState} and {Emulator.Frame}. Save the relevant state (raw data)?", "Integrity Failed!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
var sfd = new SaveFileDialog { FileName = "integrity.fresh" };
|
||||
if (sfd.ShowDialog().IsOk())
|
||||
|
@ -801,7 +801,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
while (Emulator.Frame < goToFrame);
|
||||
|
||||
MessageBox.Show("Integrity Check passed");
|
||||
DialogController.ShowMessageBox("Integrity Check passed");
|
||||
}
|
||||
|
||||
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
@ -836,7 +836,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Invalid Entry.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
DialogController.ShowMessageBox("Invalid Entry.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
if (val > 0)
|
||||
|
|
|
@ -214,7 +214,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
changesString = "The current movie has unsaved changes. Would you like to save before closing it?";
|
||||
}
|
||||
var result = MessageBox.Show(
|
||||
var result = DialogController.ShowMessageBox(
|
||||
"TAStudio will create a new project file from the current movie.\n\n" + changesString,
|
||||
"Convert movie",
|
||||
MessageBoxButtons.YesNoCancel,
|
||||
|
@ -1284,7 +1284,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show($"Invalid mnemonic string: {inputLogEntry}", "Paste Input failed!");
|
||||
DialogController.ShowMessageBox($"Invalid mnemonic string: {inputLogEntry}", "Paste Input failed!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -634,7 +634,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!skipExtToolWarning)
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
if (_owner.ShowMessageBox(
|
||||
"Are you sure want to load this external tool?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no.",
|
||||
"Confirm loading",
|
||||
MessageBoxButtons.YesNo,
|
||||
|
@ -650,18 +650,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
tool = Activator.CreateInstanceFrom(dllPath, toolTypeName ?? "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IExternalToolForm;
|
||||
if (tool == null)
|
||||
{
|
||||
MessageBox.Show($"It seems that the object CustomMainForm does not implement {nameof(IExternalToolForm)}. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
_owner.ShowMessageBox($"It seems that the object CustomMainForm does not implement {nameof(IExternalToolForm)}. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
_owner.ShowMessageBox("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
_owner.ShowMessageBox("It seems that the object CustomMainForm does not exists. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var padSchemata = ((IVirtualPadSchema) Activator.CreateInstance(schemaType))
|
||||
.GetPadSchemas(Emulator, s => MessageBox.Show(s))
|
||||
.GetPadSchemas(Emulator, s => DialogController.ShowMessageBox(s))
|
||||
.ToList();
|
||||
|
||||
if (VersionInfo.DeveloperBuild)
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
};
|
||||
if (!searchSetContains(controlSchema.Name))
|
||||
{
|
||||
MessageBox.Show(this,
|
||||
this.ModalMessageBox(
|
||||
$"Schema warning: Schema entry '{schema.DisplayName}':'{controlSchema.Name}' will not correspond to any control in definition '{Emulator.ControllerDefinition.Name}'",
|
||||
"Dev Warning");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue