Hey it's me again :)
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:
Also the other form's onclose event:
How could I make this PluginManager form run a function of MainWindow without modifying it's loadPlugins() function?
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:
Code:
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());
}
}
}
Code:
private void PluginManager_FormClosing(object sender, FormClosingEventArgs e)
{
MainWindow.loadPlugins();
}
Comment