void LSTB_MODCOLL_SelectedIndexChanged(object sender, EventArgs e) { if (LSTB_MODCOLL.SelectedItem == null) { return; } var q = (from item in pm.getModColllist() where item.ToString().Equals(LSTB_MODCOLL.SelectedItem.ToString()) select item); if (q.Count() <= 0) { return; } var mc = q.First(); deselectWads(); DGRIDV_MODS.ClearSelection(); foreach (Mod m in mc) { for (int i = 0; i < DGRIDV_MODS.Rows.Count; i++) { if (DGRIDV_MODS.Rows[i].DataBoundItem.ToString() == m.displayText) { DGRIDV_MODS.Rows[i].Cells[0].Value = true; DGRIDV_MODS.Rows[i].Cells[1].Value = m.loadOrder; } } } }
private void displayOnlySelectedModsToolStripMenuItem_Click(object sender, EventArgs e) { if (isRowFiltered) { DGRIDV_MODS.BackgroundColor = SystemColors.AppWorkspace; reloadModList(); return; } DGRIDV_MODS.ClearSelection(); BTN_LAUNCH.Focus(); List <Mod> filteredLst = new List <Mod>(); foreach (DataGridViewRow r in DGRIDV_MODS.Rows) { Console.WriteLine((bool)r.Cells[0].Value + r.Cells[2].Value.ToString()); if ((bool)r.Cells[0].Value) { filteredLst.Add(new Mod((bool)r.Cells[0].Value, (int)r.Cells[1].Value, pm.MODDIRECTORY, r.Cells[2].Value.ToString())); } } if (filteredLst.Count == 0) { return; } isRowFiltered = true; DGRIDV_MODS.DataSource = filteredLst; DGRIDV_MODS.BackgroundColor = Color.Firebrick; }