jsteedVR
Topic Author
Posts: 8
Joined: 26 Feb 2020, 01:44

EventAggregator equivalent in Noesis/c++

29 Feb 2020, 02:00

Is there an equivalent in Noesis or c++ for the Prism EventAggregator (https://prismlibrary.com/docs/event-aggregator.html) or similar pub-sub communication system? I'm trying to create a communication system between loosely coupled components like ViewModels.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: EventAggregator equivalent in Noesis/c++

03 Mar 2020, 10:19

There is nothing like that implemented by default in Noesis. You need to do it yourself.
 
jsteedVR
Topic Author
Posts: 8
Joined: 26 Feb 2020, 01:44

Re: EventAggregator equivalent in Noesis/c++

03 Mar 2020, 20:22

There is nothing like that implemented by default in Noesis. You need to do it yourself.
Is there a sample you can post of communication between ViewModels in Noesis C++? I feel like having ViewModels directly reference each other is messy and might violate the principles of MVVM. But I'm coming from the .NET world, so this might be completely different.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: EventAggregator equivalent in Noesis/c++

05 Mar 2020, 00:36

You can implement the EventAggregator idea or very similar in C++.

For example, all of your viewmodels can inherit from a ViewModelBase that receives the application event queue in its constructor, so they can subscribe to events, or publish them.
When a viewmodel needs to create other viewmodels it can pass along the application event queue to those new viewmodels.

Did you find any scenario in that EventAggregator pattern that cannot be applied to C++?

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 54 guests