I'm working with a system that registers methods as event listeners.
A typical pseudocode example is something like this:
public class Foo {
public void StartOperation(){
EventSystem.Subscribe<EventFoo>(this, Handler);
DoSomethingThatWillTriggerAnEvent();
}
void Handler(EventFoo e)
{
// Handle the event
}
}
I would like to be able to wrap this kind of event handling in an async task, so I could do something more like this.
EventFoo e = await DoSomethingThatWillTriggerAnEvent();
What's the best way to go about doing that?