Powderek
Powderek

Reputation: 251

Multiple subscribers to the same event

I'm trying to make a system for handling user settings(bunch of controls). The same settings will be implemented two times for two different environments and will control the same logic and contain the same properties. When user change value of some control in the first settings, some changes are made in the program logic and additionaly a control that handles the same property from second settings should be updated. Simple diagram: enter image description here

So it looks like there are two subscribers(Settings A & B) and three listeners(Settings A & B, Event Handler) for single event .

What would be the best way to implement this?

Upvotes: 1

Views: 1433

Answers (1)

Scott Chamberlain
Scott Chamberlain

Reputation: 127593

Sounds like what you are looking for is the Event Agitator pattern. The Microsoft library Prism has one built in that is commonly used. Get the Prism.Core nuget package to get a pre-made PubSubEvent class that implements it for you.

Upvotes: 1

Related Questions