private void cell_MenuItemClicked(object sender, CustomMenuItemClickedEventArgs e) { // e.EventKey: 0 = Select All, 1 = Clear All var shouldCheck = e.EventKey == 0; foreach (var row in e.Column.DataGridView.Rows.Cast <DataGridViewRow>().Where(row => !row.IsNewRow)) { row.Cells[e.Column.Index].Value = shouldCheck; CheckCorrespondingCell(row.Index, e.Column.Index, e.Column.DataGridView); } }
private void cell_MenuItemClicked(object sender, CustomMenuItemClickedEventArgs e) { var grid = e.Column.DataGridView; // e.EventKey: 0 = Select All, 1 = Clear All var shouldCheck = e.EventKey == 0; var rowsToChange = grid.Rows.Cast <DataGridViewRow>().Where(row => !row.IsNewRow && row.Visible && (bool)row.Cells[e.Column.Index].Value != shouldCheck).ToList(); if (shouldCheck && m_project.IsLiveParatextProject) { GetParatextScrTextWrapperIfNeeded(true); var booksToChange = new HashSet <string>(rowsToChange.Select(r => (string)r.Cells[m_colNTBookCode.Index].Value)); var booksWithFailingChecks = m_paratextScrTextWrapper.FailedChecksBooks.Where(b => booksToChange.Contains(b)).ToList(); if (booksWithFailingChecks.Any()) { var msg = Format(LocalizationManager.GetString("DialogBoxes.ScriptureRangeSelectionDlg.ExcludedParatextBookExplanation", "{0} is not reporting a current successful status for the following books for all the basic checks that {1} usually requires to pass:"******"\r\n{2}\r\n\r\n" + "Although you can ignore this warning and proceed to include these books, {1} might fail to process the data " + "properly, which could give the appearance of data loss or corruption and could even cause {1} to stop responding. " + "Therefore, you should get these checks to pass in {0} project {3} before including them:\r\n" + " {4}\r\n\r\n" + "Do you want {1} to select all the {5} books to include them in the {6} project script anyway?", "Param 0: \"Paratext\" (product name); " + "Param 1: \"Glyssen\" (product name); " + "Param 2: list of 3-letter codes of Scripture books that did not pass basic checks; " + "Param 3: Paratext project short name (unique project identifier); " + "Param 4: List of names of Paratext checks; " + "Param 5: \"Old Testament\" or \"New Testament\" (as localized); " + "Param 6: Glyssen recording project name"), ParatextScrTextWrapper.kParatextProgramName, GlyssenInfo.kProduct, Join(LocalizationManager.GetString("Common.SimpleListSeparator", ", "), booksWithFailingChecks), m_project.ParatextProjectName, m_paratextScrTextWrapper.RequiredCheckNames, grid == m_otBooksGrid ? BookSetUtils.OldTestamentLocalizedString : BookSetUtils.NewTestamentLocalizedString, m_project.Name); if (DialogResult.No == MessageBox.Show(this, msg, GlyssenInfo.kProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)) { return; } } } foreach (var row in rowsToChange) { row.Cells[e.Column.Index].Value = shouldCheck; if (e.Column.Index == m_includeInScriptColumnIndex) { SetCorrespondingMultivoiceCell(row.Index, e.Column.Index, grid); } } }