简体   繁体   中英

Event communication between IoC elements

I'm using Castle.Windsor IoC for loading plugins on runtime. These plugins provide both logic and UI implementation, such as overview and detail view panes to be inserted into my applications main window. Each provided interface implementation contains a path that distinctly references it, and the registration of the classes is in transient lifestyle mode.

Now, it seems that I am running into trouble considering communication between (UI) components: Normally I would have added delegate methods to the event queue of the UI elements inside the main windows code. But since the main window does not know anything specific about the events of the loaded controls, this would not work.

My first workaround would be to resolve the registered instance from the IoC container and attach to its event queue -- but I'm not sure if this works with transient lifestyle mode and not linking to libraries leaves me unaware of the event signatures. (What if an element from library A wants to watch another libraries event queue?)

Any ideas on how to solve this?

The Event Wiring Facility could help you setup the communication between your different components. It is a facility that lets you decouple events in Windsor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM