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.
}

 

  

posted @ 2018-08-15 14:23  树杈上的猴子  阅读(594)  评论(0编辑  收藏  举报