Это вопрос C #
Я хочу сделать синхронный вызов для асинхронных обратных вызовов.
См. Комментарий в коде для запроса
class User
{
EventHandler Service1Started()
{
"Looks like service 1 started as I got event from server class" ;
}
EventHandler Service2Started()
{
"Looks like service 2 started as I got event from server class" ;
}
public void StartServicesOnlyStartService2AfterService1Started()
{
Server server = new Server();
// want to call these 2 methods synchronously here
// how to wait till service1 has started thru the event we get
// Want to avoid polling, sleeping etc if possible
server.StartService1();
server.StartService2();
}
}