I use xamarin forms to make multiplatforms applications, I want to upload picture in a server but when I upload all pictures my application is very slowed.
I use the WebClient to make request. there is my upload function:
public static async Task<string> CreateUploadTask(string File, string vtour_id, string user_id, string user_login)
{
string requestResult = "";
using (WebClient client = new WebClient())
{
// add event listeners
client.UploadProgressChanged += Client_UploadProgressChanged;
// set the file type
client.Headers.Add("Content-Type", "image/jpeg");
// upload the file
byte[] response = await client.UploadFileTaskAsync(Database.URL_DATABASE + "uploadPicture", "POST", File);
// delete the event listeners
client.UploadProgressChanged -= Client_UploadProgressChanged;
requestResult = client.Encoding.GetString(response);
client.Dispose();
}
return requestResult;
}
After that the navigation is very slowed.
how can I improve that ?
thanks!