Skip to content

Commit 2af42d9

Browse files
committed
Pass this (tool) to RecentFiles.HandleLoadError instead of MainForm
1 parent 8830aa4 commit 2af42d9

File tree

8 files changed

+17
-10
lines changed

8 files changed

+17
-10
lines changed

src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,20 @@ public static ToolStripItem[] RecentMenu(
210210
return items.ToArray();
211211
}
212212

213-
public static void HandleLoadError(this RecentFiles recent, IMainFormForTools mainForm, string path, string encodedPath = null)
213+
public static void HandleLoadError(
214+
this RecentFiles recent,
215+
IDialogParent dialogParent,
216+
string path,
217+
string encodedPath = null)
214218
{
215-
mainForm.DoWithTempMute(() =>
219+
dialogParent.DialogController.DoWithTempMute(() =>
216220
{
217221
if (recent.Frozen)
218222
{
219-
mainForm.ShowMessageBox($"Could not open {path}", "File not found", EMsgBoxIcon.Error);
223+
dialogParent.ModalMessageBox(
224+
caption: "File not found",
225+
icon: EMsgBoxIcon.Error,
226+
text: $"Could not open {path}");
220227
}
221228
else
222229
{

src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ private void LoadFileFromRecent(string path)
562562
var result = LoadBotFile(path);
563563
if (!result && !File.Exists(path))
564564
{
565-
Settings.RecentBotFiles.HandleLoadError(MainForm, path);
565+
Settings.RecentBotFiles.HandleLoadError(this, path: path);
566566
}
567567
}
568568

src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void LoadFileFromRecent(string path)
104104
var loadResult = MainForm.CheatList.Load(Core, path, append: false);
105105
if (!loadResult)
106106
{
107-
Config.Cheats.Recent.HandleLoadError(MainForm, path);
107+
Config.Cheats.Recent.HandleLoadError(this, path: path);
108108
}
109109
else
110110
{

src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ public void LoadFileFromRecent(string path)
13301330
var result = LoadTable(path);
13311331
if (!result)
13321332
{
1333-
RecentTables.HandleLoadError(MainForm, path);
1333+
RecentTables.HandleLoadError(this, path: path);
13341334
}
13351335
else
13361336
{

src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ private void LoadSessionFromRecent(string path)
709709
{
710710
if (!LoadLuaSession(path))
711711
{
712-
Config.RecentLuaSession.HandleLoadError(MainForm, path);
712+
Config.RecentLuaSession.HandleLoadError(this, path: path);
713713
}
714714
}
715715
}

src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ private bool LoadFileWithFallback(string path)
694694

695695
if (!File.Exists(path))
696696
{
697-
Settings.RecentTas.HandleLoadError(MainForm, path);
697+
Settings.RecentTas.HandleLoadError(this, path: path);
698698
}
699699
else
700700
{

src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ private void LoadFileFromRecent(string path)
571571

572572
if (!file.Exists)
573573
{
574-
Settings.RecentSearches.HandleLoadError(MainForm, path);
574+
Settings.RecentSearches.HandleLoadError(this, path: path);
575575
}
576576
else
577577
{

src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public void LoadFileFromRecent(string path)
243243
var loadResult = _watches.Load(path, append: false);
244244
if (!loadResult)
245245
{
246-
Config.RecentWatches.HandleLoadError(MainForm, path);
246+
Config.RecentWatches.HandleLoadError(this, path: path);
247247
}
248248
else
249249
{

0 commit comments

Comments
 (0)