From 495dcd66d49a8e4dea44d9cb8ed9a86dc3cdcac3 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 29 Nov 2021 15:18:38 +0000 Subject: [PATCH] CP-38529: Make `PluginManager` public in `MainWindow.cs` To allow to open the Options page from other forms Signed-off-by: Danilo Del Busso --- XenAdmin/MainWindow.Designer.cs | 4 ++-- XenAdmin/MainWindow.cs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/XenAdmin/MainWindow.Designer.cs b/XenAdmin/MainWindow.Designer.cs index 143f76303..6bbb054d8 100644 --- a/XenAdmin/MainWindow.Designer.cs +++ b/XenAdmin/MainWindow.Designer.cs @@ -15,7 +15,7 @@ namespace XenAdmin { Program.Exiting = true; - pluginManager.PluginsChanged -= pluginManager_PluginsChanged; + PluginManager.PluginsChanged -= pluginManager_PluginsChanged; UnRegisterEvents(); if (disposing) @@ -23,7 +23,7 @@ namespace XenAdmin if (components != null) components.Dispose(); - pluginManager.Dispose(); + PluginManager.Dispose(); log.Debug("MainWindow disposing of license timer"); if (licenseTimer != null) diff --git a/XenAdmin/MainWindow.cs b/XenAdmin/MainWindow.cs index ad918e5a7..7e0dbc46b 100755 --- a/XenAdmin/MainWindow.cs +++ b/XenAdmin/MainWindow.cs @@ -128,7 +128,7 @@ namespace XenAdmin private static readonly System.Windows.Forms.Timer CheckForUpdatesTimer = new System.Windows.Forms.Timer(); - private readonly PluginManager pluginManager; + public readonly PluginManager PluginManager; private readonly ContextMenuBuilder contextMenuBuilder; private readonly LicenseManagerLauncher licenseManagerLauncher; @@ -220,11 +220,11 @@ namespace XenAdmin CommandLineArgType = argType; CommandLineParam = args; - pluginManager = new PluginManager(); - pluginManager.PluginsChanged += pluginManager_PluginsChanged; - pluginManager.LoadPlugins(); - contextMenuBuilder = new ContextMenuBuilder(pluginManager, this); - ((WinformsXenAdminConfigProvider) XenAdminConfigManager.Provider).PluginManager = pluginManager; + PluginManager = new PluginManager(); + PluginManager.PluginsChanged += pluginManager_PluginsChanged; + PluginManager.LoadPlugins(); + contextMenuBuilder = new ContextMenuBuilder(PluginManager, this); + ((WinformsXenAdminConfigProvider) XenAdminConfigManager.Provider).PluginManager = PluginManager; FormFontFixer.Fix(this); @@ -634,7 +634,7 @@ namespace XenAdmin if (result && dlg.IsCheckBoxChecked) { - using (var dialog = new OptionsDialog(pluginManager)) + using (var dialog = new OptionsDialog(PluginManager)) { dialog.SelectConnectionOptionsPage(); dialog.ShowDialog(this); @@ -1190,7 +1190,7 @@ namespace XenAdmin } selectedTabs.Remove(o); - pluginManager.DisposeURLs(o); + PluginManager.DisposeURLs(o); } } @@ -1578,7 +1578,7 @@ namespace XenAdmin consoleFeatures = new List(); otherFeatures = new List(); - var plugins = pluginManager.Plugins; + var plugins = PluginManager.Plugins; foreach (var p in plugins) { var features = p.Features; @@ -1703,7 +1703,7 @@ namespace XenAdmin bool itemAdded = false; // add plugin items for this menu at insertIndex - foreach (PluginDescriptor plugin in pluginManager.Plugins) + foreach (PluginDescriptor plugin in PluginManager.Plugins) { if (!plugin.Enabled) continue; @@ -2118,7 +2118,7 @@ namespace XenAdmin private void UpdateTabePageFeatures() { - var plugins = pluginManager.Plugins; + var plugins = PluginManager.Plugins; foreach (var p in plugins) { var features = p.Features; @@ -2689,7 +2689,7 @@ namespace XenAdmin private void preferencesToolStripMenuItem_Click(object sender, EventArgs e) { - using (var dialog = new OptionsDialog(pluginManager)) + using (var dialog = new OptionsDialog(PluginManager)) dialog.ShowDialog(this); }