I have a project and am right now at a point, where it's growing complexity forces me to think about it's structure. To explain it in a few sentences:
- I have a main application as UI. It allows the user to run different tests and should display status updates and results.
- I have a whole bunch of classes containing different tests on some hardware. All those classes implement an iTest interface to ensure compatibility.
Where I am right now: I want to have status updates (which I don't get right now). I need some kind of StatusUpdate-Event fired in the Test-Classes and receive those events in my UI. I'm new to delegates and event handlers so I have no clue which way is the best to choose for this. Following the answer from here "How to add an event to a class" means I'd have to add a event handler each time I instantiate one of my test classes. That would generate a whole load of redundant code that I think is unnecessary.
I'd like to have one function in my UI named sth. like "StatusUpdateEventHandler(string textToDisplay)". It should not matter, which Test-Class invokes this event.
Can anyone give me some direction where to go at? Thank's a lot :)