public async Task FileDownloadDB(string dropboxpath, string Zielpath, DropNetClient client) { //client = new DropNetClient(apiKey, appSecret, GetUserLoginDB(tokendb), GetUserLoginDB(secretdb)); //NORMALEASYNCDOWNLOAD /* try { client.GetFileAsync(dropboxpath, (response) => { MessageBox.Show("DO"); using (FileStream fs = new FileStream(Zielpath, FileMode.Create)) { for (int i = 0; i < response.RawBytes.Length; i++) { fs.WriteByte(response.RawBytes[i]); } } }, (error) => { MessageBox.Show("error downloading"); }); } catch(Exception ex) { MessageBox.Show(ex.Message); }*/ //TASK DOWNLOAD try { using (FileStream fs = new FileStream(Zielpath, FileMode.Create)) { RestSharp.IRestResponse ir = await client.GetFileTask(dropboxpath) as RestSharp.IRestResponse; for (int i = 0; i < ir.RawBytes.Length; i++) { fs.WriteByte(ir.RawBytes[i]); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }