Following the good ideas that I was given in my previous question on how to wait for processes to complete I would like to ask something related.
This time I don't have two processes to do one after another, but only one process that has to proceed after it gets a positive response from a server. Something like this
private async Task<bool> requestPermission()
{
var result = await sendRequestToServer();
return result;
}
private async Task Process1()
{ bool amIOktoGo=false;
amIOktoGo= await requestPermission();
while(!amIOktoGo)
{
await Task.Delay(1000);
amIOktoGo= await requestPermission();
}
//Finally! Do some more stuff involving awaits and requests from the server
}
Again, this seems overly complicated. Is there a simpler way to do this?