Questions tagged [eventaggregator]

Event Aggregator is an event mechanism that enables communications between loosely coupled components in the application. It allows publishers and subscribers to communicate through events and still do not have a direct reference to each other.

Event Aggregator can be used when you have many objects that are prospective event sources. Rather than have the observer deal with registering with them all, you can consolidate the registration logic to the Event Aggregator.

237 questions
20
votes
2 answers

Trying to understand the event aggregator pattern

I am trying to implement the event aggregator pattern in a simple way to learn it step by step. But i didn't find any book or nice video tutorial talking about it's implementation. I just found some good articles such as this…
Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301
19
votes
2 answers

Prism Event Aggregation - subscriber not triggered

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…
stiank81
  • 25,418
  • 43
  • 131
  • 202
17
votes
3 answers

How do I test Prism event aggregator subscriptions, on the UIThread?

I have a class, that subscribes to an event via PRISMs event aggregator. As it is somewhat hard to mock the event aggregator as noted here, I just instantiate a real one and pass it to the system under test. In my test I then publish the event via…
Thorsten Lorenz
  • 11,781
  • 8
  • 52
  • 62
16
votes
2 answers

backbone.js + global event dispatcher + require.js: how-to?

I have a number of backbone models, organized in collections and connected to their corresponding views and/or collections of views. Some of these models that do not belong to the same collection need to trigger an event which is of interest to…
alearg
  • 685
  • 7
  • 17
14
votes
2 answers

EventAggregator vs CompositeCommand

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…
Thorsten Lorenz
  • 11,781
  • 8
  • 52
  • 62
12
votes
3 answers

Should related Backbone.js views have references to each other, or talk through events only?

I have an application that does CRUD for a Collection of Models. There is a DisplayView for each model that is always visible. There is also an EditView that is visible only when the associated DisplayView is clicked on. The DisplayView and…
aw crud
  • 8,791
  • 19
  • 71
  • 115
12
votes
2 answers

Caliburn Micro Constructor Injection Failed

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…
ender
  • 480
  • 6
  • 23
12
votes
2 answers

When should I use an event handler over an event aggregator?

When should I be using an Event Handler versus an Event Aggregator? In my code, I have two ViewModels that controlled by a parent ViewModel, I am trying to decide if I should just use an event handler to talk between them? Or use an Event…
Bob.
  • 3,894
  • 4
  • 44
  • 76
8
votes
2 answers

Caliburn.Micro. Automatically call eventaggregator.Subscribe() for IHandle implementors with Autofac

In Caliburn.Micro documentation the authors mention such possibility: documentation link IHandle inherits from a marker interface IHandle. This allows the use of casting to determine if an object instance subscribes to any events. This enables…
Alec
  • 1,486
  • 2
  • 14
  • 30
8
votes
1 answer

Prism EventAggregator difference between PubSubEvent Class and CompositePresentationEvent Class

Im trying to get my EventAggregator in Prism working based on this example MSDN. After having some problems that where caused by mixing up class references i would like to know the difference of: PubSubEvent Class MSDN and…
ck84vi
  • 1,556
  • 7
  • 27
  • 49
8
votes
1 answer

Jon Skeet Singleton and EventAggregator

For the sake of simple inter-module communication there were classic .NET events, but there are too many right now and there are chains of events calling each other through modules. Like Event_A triggers Event_B which fires Event_C. The…
Mare Infinitus
  • 8,024
  • 8
  • 64
  • 113
8
votes
1 answer

How to return data from a subscribed method using EventAggregator and Microsoft Prism libraries

I am working on a WPF project, using MVVM and Microsoft Prism libraries. So, when I need to communicate through classes I use the class Microsoft.Practices.Prism.MefExtensions.Events.MefEventAggregator and I publish events and subscribe methods as…
Dante
  • 3,208
  • 9
  • 38
  • 56
7
votes
2 answers

Backbone.Wreqr vs Javascript Object

What are the main benefits backbone.wreqr has over a js object, both cases having access to marionette's Event aggregator. Wouldn't assigning/calling methods from an object work the same way as Commands / RequestResponse. To me i see no need to…
Ricky Boyce
  • 1,772
  • 21
  • 26
6
votes
1 answer

Passing multiple parameters to Prism's EventAggregator

I'm using Prism's EventAggregator for loosely coupled communication between my module's ViewModels. I have have several properties (e.g. FirstName, LastName) in ViewModelA which need to update properties in ViewModelB when their values change. My…
Blake Mumford
  • 17,201
  • 12
  • 49
  • 67
6
votes
4 answers

ViewModel to ViewModel Communication

Given the following scenario: ViewModelA launches ViewModelB (via a common Controller, of course, that uses Ioc and DI to resolve the types needed). ViewModelB needs to set a property value in ViewModelA. Is it bad to simply inject ViewModelA into…
1
2 3
15 16