hello, i'm using the desktop library of prism.
what i want is to get modules in a directory and then, run them.
I do like that:
DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();
catalog.ModulePath = @"C:\Users\Raph\Documents\Visual Studio 2010\Projects\LibraryLoad\LibraryLoad\Modules";
I checked, the modules are loaded in the catalog. Example of a module:
public class SendEmailClass : IModule
{
public void SendEmail()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("**", "moi");
mail.Subject = "Report"; //manage generated subject
mail.To.Add("***");
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.Port = 57;
smtp.EnableSsl = true; //depending of the smtp server
NetworkCredential cred = new NetworkCredential("***", "***");
smtp.Credentials = cred;
smtp.Send(mail);
}
public void Initialize()
{
SendEmail();
}
}
But then i want to run them (launch their Initialize()) but i don't find it. I want to run the whole catalog. someone has an idea ? I tried catalog.Initialize(), catalog.Validate() or catalog.Load()