I have a method to call an api and get the users. When I have this api call in an async method, I want to display a message "Users are loading.." until users are retrieved and displayed in my form.
need to create a task which is looking for 'users' and displays a message until users get some data.
private void ButtonLoadEvent_Click(object sender, EventArgs e)
{
lbStatus.Text = "Wait it is Loading... ";
Loading();
}
private async Task Loading()
{
await Task.Delay(100); //wait until delay finish
lbStatus.Text = "It is finished"; //then notify
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.