Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help needed with Reflection
Message
 
À
25/08/2007 17:12:31
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01250136
Message ID:
01251381
Vues:
22
Success with code below, thanks to all of you who contributed
private void frmPluginTest_Load(object sender, EventArgs e)
{
    Control oTP;
    string[] dllFilenames = Directory.GetFiles(@"P:\PJKPlugin\TabPages","TabPage*.dll",SearchOption.AllDirectories);

    foreach (string filename in dllFilenames)
    {
        try
        {
             Assembly asm = Assembly.LoadFrom(filename);
             Type[] typesInAssembly = asm.GetTypes();
             foreach (Type type in typesInAssembly)
             {
                  if (type.GetInterface("PJKPlugins.ICMSTabPage") != null)
                  {
                       ObjectHandle o = Activator.CreateInstanceFrom(filename,type.FullName);
                       oTP = (Control)o.Unwrap();
                       this.PluginTabControl.Controls.Add(oTP);
                  }
              }
          }
          
          catch(Exception ex)
          {
               Debug.WriteLine(ex.Message);
          }
     }
}
Regards,
Peter J. Kane



Pete
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform