Call Async Method in Page_Load

前端 未结 3 1969
长发绾君心
长发绾君心 2021-01-20 07:58
static async void SendTweetWithSinglePicture(string message, string image)
{
    var auth = new SingleUserAuthorizer
    {
        CredentialStore = new SingleUserIn         


        
3条回答
  •  时光取名叫无心
    2021-01-20 08:52

    You should use PageAsyncTask. It has samples in MSDN page.

    // Register the asynchronous task.
    Page.RegisterAsyncTask(new PageAsyncTask(SendTweetWithSinglePicture(message, image));
    
    // Execute the register asynchronous task.
    Page.ExecuteRegisteredAsyncTasks();
    

    as I pointed the sample and explanations on MSDN page is pretty good.

提交回复
热议问题