c# - Caliburn.Micro EventAggregator with multiple instances -
i have 2 caliburn.micro viewmodels communicating each other eventaggregator:
public class leftviewmodel { // ... public void doinright() { messanger.publishonuithread(new doinrightmessage()); } } public class rightviewmodel : ihandle<doinrightmessage> { public void handle(doinrightmessage e) { // ... } } it has worked fine until had 1 instance of leftviewmodel , righviewmodel on screen. allow arbitrary number of instances of both of them - in couples. leftviewmodel.doinright() should send message in 1 righviewmodel (the 1 in couple), not righviewmodel instances.
update 8.7.2015: how solve such pair messaging:
- some kind of message channels/groups adding parameter
targetoridmessages (thanks@jophy jobpoint me idea). - have multiple eventaggregators.
- abandon eventaggregator , call methods directly.
- or other solution?
you can try using sort of id every view.
there similar question caliburn.micro , event aggregator -unwanted call handle method
Comments
Post a Comment