diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 2f79e2dfd7..8a1cf34f74 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -21,16 +21,16 @@ namespace BizHawk.Client.EmuHawk /// /// Loads the tool dialog T, if it does not exist it will be created, if it is already open, it will be focused /// - public T Load() where T : IToolForm + public T Load(bool focus = true) where T : IToolForm { - return (T)Load(typeof(T)); + return (T)Load(typeof(T), focus); } /// /// Loads a tool dialog of type toolType if it does not exist it will be /// created, if it is already open, it will be focused. /// - public IToolForm Load(Type toolType) + public IToolForm Load(Type toolType, bool focus = true) { if (!typeof(IToolForm).IsAssignableFrom(toolType)) throw new ArgumentException(String.Format("Type {0} does not implement IToolForm.", toolType.Name)); @@ -48,8 +48,11 @@ namespace BizHawk.Client.EmuHawk } else { - existingTool.Show(); - existingTool.Focus(); + if (focus) + { + existingTool.Show(); + existingTool.Focus(); + } return existingTool; } } @@ -90,23 +93,7 @@ namespace BizHawk.Client.EmuHawk /// public IToolForm Get() where T : IToolForm { - var existingTool = _tools.FirstOrDefault(x => x is T); - if (existingTool != null) - { - if (existingTool.IsDisposed) - { - Close(); - return CreateInstance(); - } - else - { - return existingTool; - } - } - else - { - return CreateInstance(); - } + return Load(false); } public void UpdateBefore()