Android运行程序后关闭Dialog

async void myButtonClicked (object sender, EventArgs e)
{
    myProgressBar.Visibility = ViewStates.Visible;
    await myMethod();
    myProgressBar.Visibility = ViewStates.Gone;
}
async Task myMethod()
{
    await Task.Run(() => {
        // Do long running stuff here    
    });
}

if you are already calling something that uses await/async:

async Task myMethod()
{
    var result = await someAsyncMethod();
    processResult(result);
    // etc. etc.
}

  

原文地址:https://www.cnblogs.com/shawnwxm/p/9481170.html