public void SetModOn(DataGridViewRow row, ModPack mod) { DataGridViewComboBoxCell comboBoxCell = ModsSelector.GetComboBoxCell(row); if (ModsSelector.GetDataSource(comboBoxCell).Any <ModPack>((ModPack m) => m == mod)) { comboBoxCell.Value = mod; } }
public void DisableModOnAllRows(string modName) { IEnumerable <DataGridViewComboBoxCell> rows = from DataGridViewRow row in this.gridView.Rows select ModsSelector.GetComboBoxCell(row) into comboBox let dataSource = ModsSelector.GetDataSource(comboBox) where dataSource.Any <ModPack>((ModPack p) => p.Name == modName) select comboBox; foreach (DataGridViewComboBoxCell disabledItem in rows) { disabledItem.Value = ModsSelector.DisabledItem; } }
private void AddFile(ModFile file, ModPack pack) { DataGridViewRow item = this.gridView.Rows.Cast <DataGridViewRow>().FirstOrDefault <DataGridViewRow>((DataGridViewRow r) => ModsSelector.GetFileName(r).Equals(file.FileName)); if (item == null) { DataGridViewRowCollection rows = this.gridView.Rows; object[] objArray = new object[] { (file.Blocked ? Images16px.Warning : new Bitmap(1, 1)), file.FileName, file.Description, null, ModsSelector.DisabledItem }; int num = rows.Add(objArray); item = this.gridView.Rows[num]; if (file.Blocked) { DataGridViewImageCell imageCell = ModsSelector.GetImageCell(item); imageCell.ToolTipText = string.Format(gPatcher.Localization.Text.ModsSelector_FileBlockedInServers, ModsSelector.GetFileName(item), file.BlockedServers); } ModsSelector.GetPlayCell(item).ValueIsIcon = false; DataGridViewComboBoxCell comboBoxCell = ModsSelector.GetComboBoxCell(item); SortableBindingList <ModPack> sortableBindingList = new SortableBindingList <ModPack>() { ModsSelector.DisabledItem, pack }; sortableBindingList.Sort <ModPack>((ModPack t) => t); comboBoxCell.DisplayMember = "Name"; comboBoxCell.ValueMember = "Self"; comboBoxCell.ValueType = typeof(ModPack); comboBoxCell.DataSource = sortableBindingList; this.Sort(); } else { BindingList <ModPack> dataSource = ModsSelector.GetDataSource(item); if (!dataSource.Contains(pack)) { dataSource.AddSorted <ModPack>(pack); return; } } }
public bool IsDisabled(DataGridViewRow row) { return(ModsSelector.GetComboBoxCell(row).Value == ModsSelector.DisabledItem); }
private static BindingList <ModPack> GetDataSource(DataGridViewRow row) { return(ModsSelector.GetDataSource(ModsSelector.GetComboBoxCell(row))); }
protected void DisableRow(DataGridViewRow row) { ModsSelector.GetComboBoxCell(row).Value = ModsSelector.DisabledItem; }