Hi,
I have a UserPopup with 2 buttons and one of them has async /await click event. I have to click twice to make it close:
private void btnClose_Click(object sender, EventArgs e)
{
//This closes on first click
this.Close();
}
private async void btnOK_Click(object sender, EventArgs e)
{
await Task.Delay(1000);
//This does not close on first click
this.Close();
}
Please take a look at it.
Thank you for your help,
Page,
That’s because await exits the method so the response is terminated and Task.Delay() spawns another thread.
Add Application.Update(this); to push the update back to the client.
When you see it working on the second click is just because it’s also sending back the pending changes as soon as there is another request. The same would happen if you click anywhere else. Wisej makes it looks like a desktop app but on the web you still have the request/response cycle.
Please login first to submit.