private void textBoxFilter_TextChanged(object sender, EventArgs e) { StaticFilters.FilterGridView(dataGridViewLedger, textBoxFilter.Text); }
public void HistoryChanged(HistoryList hl, bool disablesorting) // on History change { if (hl == null) // just for safety { return; } Tuple <long, int> pos = CurrentGridPosByJID(); current_historylist = hl; SortOrder sortorder = dataGridViewStarList.SortOrder; int sortcol = dataGridViewStarList.SortedColumn?.Index ?? -1; if (sortcol >= 0 && disablesorting) { dataGridViewStarList.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None; sortcol = -1; } rowsbyjournalid.Clear(); systemsentered.Clear(); dataGridViewStarList.Rows.Clear(); var filter = (TravelHistoryFilter)comboBoxHistoryWindow.SelectedItem ?? TravelHistoryFilter.NoFilter; List <HistoryEntry> result = filter.Filter(hl); // last entry, first in list result = HistoryList.FilterHLByTravel(result); // keep only travel entries (location after death, FSD jumps) foreach (HistoryEntry he in result) // last first.. { if (!systemsentered.ContainsKey(he.System.Name)) { systemsentered[he.System.Name] = new List <HistoryEntry>(); } systemsentered[he.System.Name].Add(he); // first entry is newest jump to, second is next last, etc } foreach (List <HistoryEntry> syslist in systemsentered.Values) // will be in order of entry.. { AddNewHistoryRow(false, syslist); // add, with the properties of the first (latest) entry, giving the number of entries.. } StaticFilters.FilterGridView(dataGridViewStarList, textBoxFilter.Text); int rowno = FindGridPosByJID(pos.Item1, true); // find row.. must be visible.. -1 if not found/not visible if (rowno >= 0) { dataGridViewStarList.CurrentCell = dataGridViewStarList.Rows[rowno].Cells[pos.Item2]; // its the current cell which needs to be set, moves the row marker as well currentGridRow = (rowno!=-1) ? } else if (dataGridViewStarList.Rows.GetRowCount(DataGridViewElementStates.Visible) > 0) { rowno = dataGridViewStarList.Rows.GetFirstRow(DataGridViewElementStates.Visible); dataGridViewStarList.CurrentCell = dataGridViewStarList.Rows[rowno].Cells[StarHistoryColumns.StarName]; } else { rowno = -1; } dataGridViewStarList.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time"; if (sortcol >= 0) { dataGridViewStarList.Sort(dataGridViewStarList.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending); dataGridViewStarList.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder; } //System.Diagnostics.Debug.WriteLine("Fire HC"); FireChangeSelection(); // and since we repainted, we should fire selection, as we in effect may have selected a new one }
private void textBoxFilter_KeyUp(object sender, KeyEventArgs e) { StaticFilters.FilterGridView(dataGridViewLedger, textBoxFilter.Text); }