private void setupPlugins() { // 1. Populate all the plugins from disk into the property 'filenames' AggregateCatalog ag = new AggregateCatalog(); DirectoryCatalog dc = new DirectoryCatalog(@"."); // Reads the Plugins from the folder where the executable resides ag.Catalogs.Add(dc); AssemblyCatalog catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly()); CompositionContainer container = new CompositionContainer(ag); container.SatisfyImportsOnce(this); // 'SatisfyImportsOnce' means hook everything up at once // 2. Now we have all the plugins data, populate the 'DeletionMethods' property foreach (ITextToFilenames ttf in this.filenames) { DeletionMethod dm = new DeletionMethod(ttf.Title, ttf.Description, ttf.GetFilenames); dm.CheckForFilesClicked += CheckForFilesClicked; deletionMethods.Add(dm); } }
/// <summary> /// logs for tree menu deletion /// </summary> /// <param name="method">Enum of deletion method</param> /// <param name="menu"> menu that was deleted</param> public static void Deleted(DeletionMethod method, Menu.Menu menu) { WriteLog("Deleted: "+method.ToString()+"; "+menu.ToString()); }