/// <summary> /// Download files from Google Drive and replace them locally /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void CmdDownload_Click(object sender, EventArgs e) { // Warn user about overwriting files var dialogResult = MessageBox.Show(@"Are you sure? This will overwrite all your local resource files. It is irreversible.", @"Confirm overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Cancel) { return; } // Change label to display that the download is in progress lblDriveLastDownloaded.Text = @"Download in progres..."; var driveManager = new GoogleDriveManager(); var cnt = 1; foreach (var checkedItem in checkedListDownloadUploadFiles.CheckedItems) { // Update label lblDriveLastDownloaded.Text = @"Download in progress... (" + cnt++ + @"/" + checkedListDownloadUploadFiles.CheckedItems.Count + @")"; switch (checkedItem.ToString()) { case "Vacancies": await driveManager.DownloadAndReplaceFile(ResourceType.Vacancies); break; case "Blacklist": await driveManager.DownloadAndReplaceFile(ResourceType.Blacklist); break; case "Done": await driveManager.DownloadAndReplaceFile(ResourceType.Done); break; case "Companies": await driveManager.DownloadAndReplaceFile(ResourceType.Companies); break; default: break; } } _settingsManager.SetLastDriveDownload(DateTime.Now); UpdateLastDriveDownloadLabel(); }