public void ShowError(PasteError pasteError) { _noErrors = false; panelError.Visible = true; if (pasteError == null) { tbxError.Text = string.Empty; tbxError.Visible = false; Text = Description; return; } tbxError.BackColor = Color.Red; tbxError.Text = pasteError.Message; // Useful for debugging if this hangs in a test - it appears in the timeout report // ReSharper disable LocalizableElement Text = Description + " (" + pasteError.Message + ")"; // Not L10N // ReSharper restore LocalizableElement }
private void ShowTransitionError(PasteError pasteError) { tabControl1.SelectedTab = tabPageTransitionList; SetCurrentCellForPasteError(gridViewTransitionList, pasteError); }
private void ShowProteinError(PasteError pasteError) { tabControl1.SelectedTab = tabPageProteinList; SetCurrentCellForPasteError(gridViewProteins, pasteError, colProteinName.Index); }
private void ShowPeptideError(PasteError pasteError) { tabControl1.SelectedTab = tabPagePeptideList; SetCurrentCellForPasteError(gridViewPeptides, pasteError); }
private void SetCurrentCellForPasteError(DataGridView gridView, PasteError pasteError, int? columnIndex = null) { ShowError(pasteError); if (gridView.Rows[pasteError.Line].Cells[columnIndex ?? pasteError.Column].Visible) { gridView.CurrentCell = gridView.Rows[pasteError.Line].Cells[columnIndex ?? pasteError.Column]; } else { // Set the row even if desired column isn't visible - just pick the first available column for (var firstVisibleColumn = 0; firstVisibleColumn < gridView.Rows[pasteError.Line].Cells.Count; firstVisibleColumn++) { if (gridView.Rows[pasteError.Line].Cells[firstVisibleColumn].Visible) { gridView.CurrentCell = gridView.Rows[pasteError.Line].Cells[firstVisibleColumn]; break; } } } }
private void ShowFastaError(PasteError pasteError) { PanelError.Visible = true; if (pasteError == null) { TbxError.Text = string.Empty; TbxError.Visible = false; return; } TbxError.BackColor = Color.Red; TbxError.Text = pasteError.Message; TbxError.Visible = true; TbxFasta.SelectionStart = Math.Max(0, TbxFasta.GetFirstCharIndexFromLine(pasteError.Line) + pasteError.Column); TbxFasta.SelectionLength = Math.Min(pasteError.Length, TbxFasta.Text.Length - TbxFasta.SelectionStart); TbxFasta.Focus(); }