private async void UploadDocumentButton_Click(object sender, EventArgs e) { try { var openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = false; openFileDialog.Filter = "PDF files (*.pdf)|*.pdf"; if (openFileDialog.ShowDialog() == DialogResult.OK) { UploadDocumentLoadingPictureBox.Visible = true; using (var stream = new System.IO.FileStream(openFileDialog.FileName, System.IO.FileMode.Open)) { await _googleDriveService.UploadDocument(stream, openFileDialog.SafeFileName); } var gdFiles = await _googleDriveService.GetAll(); GDGridView.DataSource = gdFiles; } } catch (Exception) { throw; } finally { UploadDocumentLoadingPictureBox.Visible = false; } }