In another way so that calls can be called a main implementation when loading wait for window
This. SplashScreenManager1. ShowWaitForm ();
Task
This. SplashScreenManager1. CloseWaitForm ();
CodePudding user response:
What should we do with an error?CodePudding user response:
You this is not a DCLInterface asynchronous method, if the method is an asynchronous method, load before you only need to await the pop-up box, await closed after loading frame,CodePudding user response:
Give you an asynchronous methodpublic static class CallWebAPI
{
Public static async TaskAPIPost (url string, the string data)
{
The string result=string. The Empty;
//set HttpClientHandler AutomaticDecompression
(1) {var handler=new HttpClientHandler AutomaticDecompression=DecompressionMethods. GZip};
//create the HttpClient (note that the incoming HttpClientHandler)
Using HTTP=new HttpClient (var (handler))
{
//using FormUrlEncodedContent do HttpContent
Var content=new FormUrlEncodedContent (new Dictionary()
{
//pass a single value
{" ", the data}//keys must be empty
//transfer object
//{" name ", "hello"},
//{" age ", "16"}
});
//await an asynchronous response to
Var response=HTTP. Await PostAsync (url, the content);
//to ensure the success of the HTTP status value
The response. EnsureSuccessStatusCode ();
//await asynchronous read last JSON (note that the gzip automatically extract had been made, and because of the above AutomaticDecompression=DecompressionMethods. Gzip)
Result=await the response. The content. ReadAsStringAsync ();
}
return result;
}
The static async void APIGet (string url)
{
//create the HttpClient (note that the incoming HttpClientHandler)
(1) {var handler=new HttpClientHandler AutomaticDecompression=DecompressionMethods. GZip};
Using HTTP=new HttpClient (var (handler))
{
//await an asynchronous response to
Var response=HTTP. Await GetAsync (url);
//to ensure the success of the HTTP status value
The response. EnsureSuccessStatusCode ();
//await asynchronous read last JSON (note that the gzip automatically extract had been made, and because of the above AutomaticDecompression=DecompressionMethods. Gzip)
Console. WriteLine (await the response. The content. ReadAsStringAsync ());
}
}
}
CodePudding user response: