c# - Event wiring with mef -


can me problem? i'm working mef framework, communicate via events "the module" plugin.

i've created shared interface between 2 parts

public class basemodule  {               public event eventhandler<feedbackarguments> sendfeedback;     public event eventhandler<resultarguments> 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});      } } 

this module:

[export(typeof(imodule))]     public class tests : basemodule, imodule     {      public void rememberdescription()         {             invokeresult(true, "please remember upload description","rememberdescription");         } 

and import module this:

[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)     {      } 

the event gets triggered in module itself, reason event doesn't fired or listener doesn't work should. appreciated.

the normal events won't work in mef, used event aggregator instead worked me


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -