Code: Select all
private void LoadApplets()
{
//Load Applets
string[] AppletPaths = System.IO.Directory.GetDirectories(Application.StartupPath + "\\Applets");
for (int i = 0; i < AppletPaths.Length; i++)
{
//Check for File
string AppletLocation = AppletPaths[i] + "\\Beta Applet.dll";
if (File.Exists(AppletLocation))
{
//Get Name
string AppletName = AppletPaths[i].Replace(Application.StartupPath + "\\Applets\\", "");
//Get Assembly
Assembly asm = Assembly.LoadFile(AppletLocation);
Type type = asm.GetType("Beta_Applet.AppletUI");
var obj = Activator.CreateInstance(type);
CollapsablePanel CP = new CollapsablePanel();
CP.Text = AppletName;
((Control)obj).Dock = DockStyle.Fill;
CP.Controls.Add((Control)obj);
CP.Size = new Size(4 + ((Control)obj).Width, 22 + ((Control)obj).Height);
this.Controls.Add(CP);
}
}
ReloadWindowsMenuItem();
}