eventaggregator

Prism Event Aggregation - subscriber not triggered

回眸只為那壹抹淺笑 提交于 2019-12-09 05:09:16
问题 I'm working on implementing an event aggregation with Prism. I have a few modules, and I want each of them to subscribe to events that tells them when they are requested. I started out doing an all plain example with both subscribed and publisher in the shell. No problems there. Now; when I move the subscribers out to my modules they don't get triggered. What's even more odd is that it actually has worked a few times - all of which I've been pending in a breakpoint. So it seems to me to be

Caliburn.Micro and event aggregator -unwanted call handle method

一曲冷凌霜 提交于 2019-12-08 02:32:28
问题 I have one problem with publish/handle messages between 2 screens. My scenario is: Messenger screen, is it master screen, publish on chat screens, they are slave screens. Messenger view model handle with messages from server. Chat screen can publishes messages on messenger screen. And messanger view model send this message on server. Messenger class look like this: [Export("MessengerScreen", typeof(IMessengerViewModel))] public class MessengerViewModel : Screen, IMessengerViewModel,

EventAggregator and ServiceLocator Issue

℡╲_俬逩灬. 提交于 2019-12-08 01:44:44
问题 I started working on a WPF project using Prism and MVVM, and I am trying to use the eventAggregator but, when the line below is executed an exception is raised: IServiceLocator ob = ServiceLocator.Current; // This line causes a Null pointer exception EventAggregator = ob.GetInstance<IEventAggregator>(); But I cant understand what I am doing wrong, maybe this is a very simple thing, but I have been struggling with this for a couple hours. Hope someone can help me, thanks in advance 回答1: You

Using Prism 6 Event Aggregator between view models with an object as the payload

烈酒焚心 提交于 2019-12-06 15:35:08
Hi I'm hoping one of you could help me with some syntax. So I'm following this example https://www.codeproject.com/Tips/591221/Simple-EventAggregator-in-WPF-PRISM on using Prism Event Aggregator to send messages from one ViewModel to another. The following code works great when publishing a single string as the payload. internal class OrderSelectedEvent_SS : PubSubEvent<string> { private static readonly EventAggregator _eventAggregator; private static readonly OrderSelectedEvent_SS _event; static OrderSelectedEvent_SS() { _eventAggregator = new EventAggregator(); _event = _eventAggregator

EventAggregator and ServiceLocator Issue

99封情书 提交于 2019-12-06 12:45:17
I started working on a WPF project using Prism and MVVM, and I am trying to use the eventAggregator but, when the line below is executed an exception is raised: IServiceLocator ob = ServiceLocator.Current; // This line causes a Null pointer exception EventAggregator = ob.GetInstance<IEventAggregator>(); But I cant understand what I am doing wrong, maybe this is a very simple thing, but I have been struggling with this for a couple hours. Hope someone can help me, thanks in advance You lack the initialization code of your locator. Either you use Prism (do you?) and you need to set up your

Caliburn.Micro and event aggregator -unwanted call handle method

ε祈祈猫儿з 提交于 2019-12-06 08:13:16
I have one problem with publish/handle messages between 2 screens. My scenario is: Messenger screen, is it master screen, publish on chat screens, they are slave screens. Messenger view model handle with messages from server. Chat screen can publishes messages on messenger screen. And messanger view model send this message on server. Messenger class look like this: [Export("MessengerScreen", typeof(IMessengerViewModel))] public class MessengerViewModel : Screen, IMessengerViewModel, IInitializable<Account>, IHandle<Rp> { // ... [ImportingConstructor] public MessengerViewModel(IPokecService

EventAggregator vs CompositeCommand

喜欢而已 提交于 2019-12-03 11:42:32
问题 I worked my way through the Prism guidance and think I got a grasp of most of their communication vehicles. Commanding is very straightforward, so it is clear that the DelegateCommand will be used just to connect the View with its Model. It is somewhat less clear, when it comes to cross Module Communication, specifically when to use EventAggregation over Composite Commands. The practical effect is the same e.g. You publish an event -> all subscribers receive notice and execute code in

Caliburn Micro Constructor Injection Failed

假装没事ソ 提交于 2019-12-03 09:24:37
问题 I am learning Caliburn Micro and try to make use of the EventAggregator from the official site. However, I got an exception "No parameterless constructor defined for this object." The message itself is clear but the example doesn't include a parameterless constructor either. If i add one, the constructor with parameter is not hit and the IEventAggregator is still not injected correctly. Here is my publisher VM after adding the parameterless constructor (without it, exception will be thrown):

Prism Event Aggregation - subscriber not triggered

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 05:12:21
I'm working on implementing an event aggregation with Prism. I have a few modules, and I want each of them to subscribe to events that tells them when they are requested. I started out doing an all plain example with both subscribed and publisher in the shell. No problems there. Now; when I move the subscribers out to my modules they don't get triggered. What's even more odd is that it actually has worked a few times - all of which I've been pending in a breakpoint. So it seems to me to be some race condition, but I don't understand why. Assumption made: I don't need to set up the

Prism - EventAggregator.GetEvent<>.Subscribe() - Using Generics & Contraints

泪湿孤枕 提交于 2019-12-02 01:49:57
I am having an issue subscribing to events with the event Aggregator that comes as part of the prism framework. If I use something such as eventAggregator.GetEvent<string>().Subscribe(MyMethod) then it all works ok, my method fires when an event has been published. However, when moving to a more complex object other than I string I run into problems. I have a bunch of classes that all derive from an Interface (IRequest) for example I have my event class setup as follows public class MyEvent<TRequest> : PubSubEvent<MyClass<TRequest>> where TRequest : IRequest {} I have a generic class (MyClass)