private void CreateFindAndReplaceDialog() { if (findAndReplaceDialog == null || findAndReplaceDialog.IsDisposed) { findAndReplaceDialog = new SearchAndReplaceDialog(); findAndReplaceDialog.Show(this); if (AreMultipleCellsSelected()) { ResetHighlightedCellsBackground(); HightlightedCellsBackground = GetSelectedCells(); dataGridView.ClearSelection(); } findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent; findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent; findAndReplaceDialog.ReplaceAllEvent += findAndReplaceDialog_ReplaceAllEvent; findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent; findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing; searchIterator = null; DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace; if (Content.FilterLogic.IsFiltered) { findAndReplaceDialog.DisableReplace(); } } }
protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (Content != null) { if (e.Button == MouseButtons.Left) { dataGridView.Focus(); dataGridView.ClearSelection(); dataGridView.SelectionChanged -= dataGridView_SelectionChanged; for (int i = 0; i < dataGridView.RowCount; i++) { if (i + 1 == dataGridView.RowCount) { dataGridView.SelectionChanged += dataGridView_SelectionChanged; } dataGridView[e.ColumnIndex, i].Selected = true; } } else if (e.Button == MouseButtons.Middle) { int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; Content.PreProcessingData.InsertColumn <double>(newIndex.ToString(), newIndex); } else if (e.Button == MouseButtons.Right && Content.SortableView) { SortColumn(e.ColumnIndex); } } searchIterator = null; }
private void DataGridView_SelectionChanged_FindAndReplace(object sender, EventArgs e) { if (Content != null) { if (!isSearching && AreMultipleCellsSelected()) { ResetHighlightedCellsBackground(); HightlightedCellsBackground = GetSelectedCells(); searchIterator = null; } } }
private void FilterLogic_FilterChanged(object sender, EventArgs e) { OnContentChanged(); searchIterator = null; if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) { if (Content.PreprocessingData.IsFiltered) { findAndReplaceDialog.DisableReplace(); } else { findAndReplaceDialog.EnableReplace(); } } btnReplace.Enabled = !Content.PreprocessingData.IsFiltered; }
protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (Content == null) return; if (e.Button == MouseButtons.Middle) { int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; Content.PreprocessingData.InsertColumn<double>(newIndex.ToString(), newIndex); } else if (e.Button == MouseButtons.Right && Content.SortableView) { SortColumn(e.ColumnIndex); } searchIterator = null; }
void findAndReplaceDialog_FindNextEvent(object sender, EventArgs e) { if (searchIterator == null || currentSearchText != findAndReplaceDialog.GetSearchText() || currentComparisonOperation != findAndReplaceDialog.GetComparisonOperation()) { searchIterator = new FindPreprocessingItemsIterator(FindAll(findAndReplaceDialog.GetSearchText())); currentSearchText = findAndReplaceDialog.GetSearchText(); currentComparisonOperation = findAndReplaceDialog.GetComparisonOperation(); } if (IsOneCellSelected()) { var first = GetSelectedCells().First(); searchIterator.SetStartCell(first.Key, first.Value[0]); } bool moreOccurences = false; currentCell = searchIterator.GetCurrent(); moreOccurences = searchIterator.MoveNext(); if (IsOneCellSelected() && currentCell != null) { var first = GetSelectedCells().First(); if (currentCell.Item1 == first.Key && currentCell.Item2 == first.Value[0]) { if (!moreOccurences) { searchIterator.Reset(); } currentCell = searchIterator.GetCurrent(); moreOccurences = searchIterator.MoveNext(); if (!moreOccurences) { searchIterator.Reset(); } } } dataGridView.ClearSelection(); if (currentCell != null) { dataGridView[currentCell.Item1, currentCell.Item2].Selected = true; dataGridView.CurrentCell = dataGridView[currentCell.Item1, currentCell.Item2]; } }
private void FilterLogic_FilterChanged(object sender, EventArgs e) { OnContentChanged(); searchIterator = null; if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) { if (Content.FilterLogic.IsFiltered) { findAndReplaceDialog.DisableReplace(); } else { findAndReplaceDialog.EnableReplace(); } } btnReplace.Enabled = !Content.FilterLogic.IsFiltered; }
void findAndReplaceDialog_FormClosing(object sender, FormClosingEventArgs e) { ResetHighlightedCellsBackground(); searchIterator = null; DataGridView.SelectionChanged -= DataGridView_SelectionChanged_FindAndReplace; }
protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (Content != null) { if (e.Button == MouseButtons.Left) { dataGridView.Focus(); dataGridView.ClearSelection(); dataGridView.SelectionChanged -= dataGridView_SelectionChanged; for (int i = 0; i < dataGridView.RowCount; i++) { if (i + 1 == dataGridView.RowCount) dataGridView.SelectionChanged += dataGridView_SelectionChanged; dataGridView[e.ColumnIndex, i].Selected = true; } } else if (e.Button == MouseButtons.Middle) { int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; Content.PreProcessingData.InsertColumn<double>(newIndex.ToString(), newIndex); } else if (e.Button == MouseButtons.Right && Content.SortableView) { SortColumn(e.ColumnIndex); } } searchIterator = null; }
private void Content_Changed(object sender, DataPreprocessingChangedEventArgs e) { OnContentChanged(); searchIterator = null; }