private async void largeFileToolStripMenuItem_Click(object sender, EventArgs e) { string filename; var stream = GetFileStreamForUpload("Path", out filename); if (null == stream) { return; } FormInputDialog dialog = new FormInputDialog("Type Path", "Path to store file:"); dialog.InputText = this.CurrentFolder.Path() + "/" + filename; var result = dialog.ShowDialog(); if (result != System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(dialog.InputText)) { return; } string path = dialog.InputText; try { var newItemReference = ODConnection.ItemReferenceForDrivePath(path); FormUploadProgress uploadForm = new FormUploadProgress(filename); var uploadOptions = ItemUploadOptions.Default; uploadOptions.ProgressReporter = uploadForm.UpdateProgress; uploadForm.Show(); var newItem = await Connection.UploadLargeFileAsync(newItemReference, stream, uploadOptions); if (null != newItem) { AddItemToFolderContents(newItem); } uploadForm.Close(); } catch (ODException exception) { PresentOneDriveException(exception); } }
private async void largeFileToolStripMenuItem_Click(object sender, EventArgs e) { string filename; var stream = GetFileStreamForUpload("Path", out filename); if (null == stream) return; FormInputDialog dialog = new FormInputDialog("Type Path", "Path to store file:"); dialog.InputText = this.CurrentFolder.Path() + "/" + filename; var result = dialog.ShowDialog(); if (result != System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(dialog.InputText)) { return; } string path = dialog.InputText; try { var newItemReference = ODConnection.ItemReferenceForDrivePath(path); FormUploadProgress uploadForm = new FormUploadProgress(filename); var uploadOptions = ItemUploadOptions.Default; uploadOptions.ProgressReporter = uploadForm.UpdateProgress; uploadForm.Show(); var newItem = await Connection.UploadLargeFileAsync(newItemReference, stream, uploadOptions); if (null != newItem) { AddItemToFolderContents(newItem); } uploadForm.Close(); } catch (ODException exception) { PresentOneDriveException(exception); } }