I am developing an application to upload a file to Google Drive using the API Drive. I can upload the image successfully. But my problem is that when I cancel the download, it does not cancel. I am reading the following code:
Google.Apis.Drive.v2.Data.File image = new Google.Apis.Drive.v2.Data.File();
image.Title = fileName;
image.MimeType = "image/jpeg";
strm.Position = 0;
System.Threading.CancellationTokenSource ctsUpload = new CancellationTokenSource();
FilesResource.InsertMediaUpload request = App.GoogleDriveClient.Files.Insert(image, strm, "image/jpeg");
request.ChunkSize = 512 * 1024;
request.ProgressChanged += request_ProgressChanged;
request.UploadAsync(ctsUpload.Token);
The following code is written to cancel a pop-click event
ctsUpload.Cancel();
source
share