I will have some more noobish questions today, so prepare yourselves!
So here you go:
In my app when I close a form, I want a menu update script to be ran, because on the other form the user can modify some folders what are present in the menu bar too.
But I can't do that until I change my
public void loadPlugins()
into
public static void loadPlugins()
.
But if I do, some of my commands become invalid.
Here is the code:
Expand|Select|Wrap|Line Numbers
- public void loadPlugins()
- {
- DirectoryInfo pluginDir = new DirectoryInfo(Application.StartupPath + "//plugins//");
- DirectoryInfo[] plugins = pluginDir.GetDirectories();
- if (plugins.Length == 0)
- {
- ToolStripItem noAddon = pluginsToolStripMenuItem.DropDownItems.Add("[NO ADDONS]");
- noAddon.Enabled = false;
- }
- else
- {
- foreach (DirectoryInfo plugin in plugins)
- {
- pluginsToolStripMenuItem.DropDownItems.Add(plugin.ToString());
- }
- }
- }
Expand|Select|Wrap|Line Numbers
- private void PluginManager_FormClosing(object sender, FormClosingEventArgs e)
- {
- MainWindow.loadPlugins();
- }