I am stuck in developing a clean design for my problem (below). I looked at the pub / sub or observer pattern, but my problem seems to be the opposite of these approaches if I just don't think correctly. Maybe the Mediator template will work, but still it seems to me that this does not seem to be correct. So, any help in what design is needed here, please let me know :)
My problem is that I need a handler that can handle events from multiple sources. I need a hotkey manager that can manage events from multiple locations. IE If a key is pressed, then some action must occur. Or, if the button is pressed on a microphone (another source), then the action should happen.
My current idea is to implement the manager as a singleton (not a huge fan of this ...), and classes will be registered in it. Classes would need to implement an interface that would guarantee a specific event to which the manager joined (when they were registered). I just don’t like it, because the class will have to raise this event, which is not a guarantee of the contract itself
source share