private async void btn_DeleteFiles_Click(object sender, EventArgs e) { for (int i = 0; i < CurrentShownFiles.Count; i++) { if (CurrentShownFiles[i] == null || CurrentShownFiles[i].CurrentState == FileStatus.Deleted) { continue; } if (CurrentShownFiles[i].IsSelected) { bool success = await ApiCommunication.DeleteFileRequest(CurrentShownFiles[i].FileStructOnline.FullName, UserSettings.UserAccessToken, i); } } }
private async void FileDownloadSuccessful(object sender, FileDownloadResultEventArgs e) { CurrentShownFiles[e.ID].progress_Download.Visible = false; CurrentShownFiles[e.ID].panel_CheckMark.Visible = true; CurrentShownFiles[e.ID].panel_CheckMark.Invalidate(); CurrentShownFiles[e.ID].CurrentState = FileStatus.Finished; if (check_DeleteAfterDownload.Checked) { if (CurrentShownFiles[e.ID].CurrentState != FileStatus.Deleted) { bool success = await ApiCommunication.DeleteFileRequest(CurrentShownFiles[e.ID].FileStructOnline.FullName, UserSettings.UserAccessToken, e.ID); } } DownloadNextFile(); }