title: Event wiring with mef
body: <p>Can anyone help me with this problem? I'm working with the MEF framework, but I would like to communicate via events with "the module" to the plugin. </p>
  
  <p>I've created a shared interface between those two parts this </p>
  
  <pre><code>public class BaseModule 
  {          
      public event EventHandler&lt;FeedBackArguments&gt; SendFeedBack;
      public event EventHandler&lt;ResultArguments&gt; SendResult;
  
  
      public void InvokeFeedback(string message) {
  
          if (SendFeedBack != null)
              SendFeedBack(this, new FeedBackArguments{FeedbackString = message, FeedbackDate = DateTime. public void InvokeResult(bool passed, string resultMessage, string test) {
  
          if (SendResult != null)
              SendResult(this, new ResultArguments { Resultstring = resultMessage, Passed = passed, PassedTime = DateTime.Now, Teststring = test});
  
      }
  }
  </code></pre>
  
  <p>this is my module:</p>
  
  <pre><code>[Export(typeof(IModule))]
      public class Tests : BaseModule, IModule
      {
       public void RememberDescription()
          {
              InvokeResult(true, "Please remember to upload a description","Rememberdescription");
          }
  </code></pre>
  
  <p>And I would like to import the module like this:</p>
  
  <pre><code>[Import(typeof(IModule))]
  
  public IModule MEF;
    public void RunTests(string list)
      {
  
              AggregateCatalog catalog = new AggregateCatalog();
              catalog.Catalogs.Add(new DirectoryCatalog(folderlocator));
  
              try
              {
                  CompositionContainer container = new CompositionContainer(catalog);
                  container.ComposeParts(this);
  
  
  
                  MEF.SendResult += MEF_SendResult;
  
  
  
              }
              catch (Exception e)
              {
                  Console.WriteLine(e.Message);
  
              }
          }
  
      }
  
      void MEF_SendFeedBack(object sender, FeedBackArguments e)
      {
  
      }
  
      void MEF_SendResult(object sender, ResultArguments e)
      {
  
      }
  </code></pre>
  
  <p>The event gets triggered in the module itself, but for some reason the event doesn't get fired or the listener doesn't work as it should. Help is very much appreciated.</p>