diff --git a/ObservatoryCore/PluginManagement/PluginCore.cs b/ObservatoryCore/PluginManagement/PluginCore.cs index 0e945a5..16509d0 100644 --- a/ObservatoryCore/PluginManagement/PluginCore.cs +++ b/ObservatoryCore/PluginManagement/PluginCore.cs @@ -284,10 +284,24 @@ public JournalEventArgs DeserializeEvent(string json, bool replay = false) public void FocusPlugin(string pluginName) { - ExecuteOnUIThread(() => + // pluginName here is based on "short name" whereas windows are named using full name. + // Find the plugin by short name and proceed with the full name. + IObservatoryPlugin? plugin = null; + foreach (var p in PluginManager.GetInstance.AllUIPlugins) { - FormsManager.FocusPluginTabOrWindow(pluginName); - }); + if (p.ShortName == pluginName) + { + plugin = p; + break; + } + } + if (plugin != null) + { + ExecuteOnUIThread(() => + { + FormsManager.FocusPluginTabOrWindow(plugin); + }); + } } internal void Shutdown() diff --git a/ObservatoryCore/UI/FormsManager.cs b/ObservatoryCore/UI/FormsManager.cs index 083a43e..c9870e5 100644 --- a/ObservatoryCore/UI/FormsManager.cs +++ b/ObservatoryCore/UI/FormsManager.cs @@ -81,10 +81,10 @@ public static void OpenPluginPopoutForm(IObservatoryPlugin plugin, TabPage? plug } } - public static void FocusPluginTabOrWindow(string pluginName) + public static void FocusPluginTabOrWindow(IObservatoryPlugin plugin) { // Check first if the plugin is popped out and activate/raise that window. - Form? pluginPopout = FormsManager.GetFormByTitle(pluginName); + Form? pluginPopout = FormsManager.GetFormByTitle(plugin.Name); if (pluginPopout != null) { pluginPopout.Activate(); @@ -92,7 +92,7 @@ public static void FocusPluginTabOrWindow(string pluginName) else { // Otherwise, switch the main window to that tab. - FindCoreForm()?.FocusPlugin(pluginName); + FindCoreForm()?.FocusPlugin(plugin.ShortName); } } }