public void Remove(IArchServerPlugIn aPlugIn) { if (mPlugIns.Contains(aPlugIn)) { mPlugIns.Remove(aPlugIn); } }
private void AppendPlugIn(IArchServerPlugIn aPlugIn) { var item = new ListViewItem { Text = aPlugIn.Name, Checked = true, ImageIndex = 0, Tag = aPlugIn }; item.SubItems.Add(aPlugIn.Version); item.SubItems.Add(aPlugIn.Author); item.SubItems.Add(aPlugIn.Description); mPlugInsListView.Items.Add(item); }
public void AddPlugIn(string aFileName) { // reate a new assembly from the plugin file we're adding.. Assembly assembly = Assembly.LoadFrom(aFileName); //Next we'll loop through all the Types found in the assembly foreach (Type type in assembly.GetTypes()) { if (!type.IsPublic) { continue; } if (type.IsAbstract) { continue; } // Gets a type object of the interface we need the plugins to match Type typeInterface = type.GetInterface("ArchBench.IArchServerPlugIn", true); // Make sure the interface we want to use actually exists if (typeInterface == null) { continue; } // Create a new instance and store the instance in the collection for later use IArchServerPlugIn instance = (IArchServerPlugIn)Activator.CreateInstance(assembly.GetType(type.ToString())); // Set the Plugin's host to this class which inherited IPluginHost instance.Host = mHost; // Call the initialization sub of the plugin instance.Initialize(); //Add the new plugin to our collection here mPlugIns.Add(instance); // Cleanup a bit instance = null; typeInterface = null; } assembly = null; // More cleanup }
public PlugInsSettingsForm(IArchServerPlugIn aPlugIn) { InitializeComponent(); mSettingsPropertyGrid.SelectedObject = new UI.DictionaryPropertyGridAdapter(aPlugIn.Parameters); }