private async Task GetFileRequestLink(FolderMetadata folder) { FileRequest fileRequest = await DropboxHandler.HandleCreateFileRequest(client, folder.PathLower, folder.Name, DateTime.Now + new TimeSpan(7, 0, 0, 0)); if (fileRequest == null) { return; } RequestLink_TextBox.Text = fileRequest.Url; }
private async void CreateFolder_Button_Click(object sender, RoutedEventArgs e) { string path = String.Format("/ExternalUpload/Cloud Data/{0} - {1}", CreateFolder_AccountName_TextBox.Text, CreateFolder_TicketNumber_TextBox.Text); FolderMetadata folder = await DropboxHandler.HandleCreateFolder(client, path); if (folder == null) { return; } await ChangeToFolder(client, "/ExternalUpload/Cloud Data/"); await GetFileRequestLink(folder); }
private async void GetShareLink_Button_Click(object sender, RoutedEventArgs e) { FileShareLink_TextBox.Text = null; Metadata selectedItem = DropboxFolderContent.SelectedIndex > -1 ? ((Metadata)DropboxFolderContent.SelectedItem) : null; if (selectedItem == null) { return; } if (selectedItem.IsFolder) { MessageBox.Show("This is a folder. Please select a file to share."); return; } if (selectedItem.IsDeleted) { MessageBox.Show("This item has been deleted and cannot be shared. I don't even know why it's displaying here. I don't even know why I'm making this error, you should never see it... In fact it might be possible to share the file, I haven't checked. I'm just not going to let you try."); return; } SharedLinkMetadata share = await DropboxHandler.HandleShareFile(client, selectedItem, RequestedVisibility.Password.Instance, "password"); if (share.Url != null) { FileShareLink_TextBox.Text = share.Url; try { Clipboard.SetDataObject(share.Url); } catch (Exception error) { MessageBox.Show("Unable to copy to clipboard. This can be caused by a an active WebEx session interfering with clipboard operations. Try again after closing your WebEx session.\n\n" + error.Message); } } }
private async Task ChangeToFolder(DropboxClient client, string path, bool recursive = false) { DropboxFolderContent.ItemsSource = await DropboxHandler.GetFolderContent(client, path, recursive); CurrentDirectoryPath_Label.Content = path; }
public async void DoTheThing() { client = DropboxHandler.SetupClient(); await ChangeToFolder(client, ""); }