Fix bug where adding to Ram Watch from another dialog while it has changes and autoload is on was asking you to save changes before adding an address

This commit is contained in:
adelikat 2014-03-01 19:16:17 +00:00
parent f15a1bc36b
commit 877d81b0ff
1 changed files with 15 additions and 1 deletions

View File

@ -38,6 +38,20 @@ namespace BizHawk.Client.EmuHawk
return result;
}
/// <summary>
/// Determines whether a given IToolForm is already loaded
/// </summary>
public bool IsLoaded<T>() where T : IToolForm
{
var existingTool = _tools.FirstOrDefault(x => x is T);
if (existingTool != null)
{
return !existingTool.IsDisposed;
}
return false;
}
/// <summary>
/// Returns true if an instance of T exists
/// </summary>
@ -407,7 +421,7 @@ namespace BizHawk.Client.EmuHawk
public void LoadRamWatch(bool loadDialog)
{
if (Global.Config.RecentWatches.AutoLoad && !Global.Config.RecentWatches.Empty)
if (!IsLoaded<RamWatch>() && Global.Config.RecentWatches.AutoLoad && !Global.Config.RecentWatches.Empty)
{
GlobalWin.Tools.RamWatch.LoadFileFromRecent(Global.Config.RecentWatches[0]);
}