public void RemoveColumn(PropertyPath propertyPath) { int index = IndexOfCanconical(propertyPath); if (index < 0) { return; } var newColumns = ColumnSpecs.ToList(); newColumns.RemoveAt(index); ColumnSpecs = newColumns; }
private void BtnRemoveOnClick(object sender, EventArgs e) { var newColumns = ColumnSpecs.Where((columnSpec, index) => !listViewColumns.Items[index].Selected).ToArray(); if (newColumns.Length == ColumnSpecs.Count) { return; } int firstSelection = listViewColumns.SelectedIndices.Cast<int>().Min(); ColumnSpecs = newColumns; listViewColumns.SelectedIndices.Clear(); if (newColumns.Length > 0) { listViewColumns.SelectedIndices.Add(Math.Min(firstSelection, newColumns.Length - 1)); } }
public MegaMillions(string appPath) : base(appPath) { Name = EnumLotteries.MegaMillions.ToString(); FilePath = System.IO.Path.Combine(appPath, FileName); ColumnSpecs.OverrideColumnName(ColumnHeader.SpecialNumber, "Mega Ball"); ColumnSpecs.OverrideColumnName(ColumnHeader.SpecialPlay, "Megaplier"); Url = "https://txlottery.org/export/sites/lottery/Games/Mega_Millions/Winning_Numbers/megamillions.csv"; megaballPattern = new PatternSection[] { PatternSection.str, PatternSection.month, PatternSection.day, PatternSection.year, PatternSection.number, PatternSection.number, PatternSection.number, PatternSection.number, PatternSection.number, PatternSection.specialnumber, PatternSection.plays }; UpdateIndexes(megaballPattern); NumberMax = numberMax; SpecialNumberMax = specialNumberMax; SpecialPlayIndex = 10; HistoricNumMax = historicNumMax; HistoricSpecialNumMax = historicSpecialNumMax; }
private void listViewColumns_AfterLabelEdit(object sender, LabelEditEventArgs e) { if (!_inLabelEdit) { return; } if (null == e.Label) { _inLabelEdit = false; return; } var columns = ColumnSpecs.ToArray(); if (string.IsNullOrEmpty(e.Label)) { columns[e.Item] = columns[e.Item].SetCaption(null); } else { columns[e.Item] = columns[e.Item].SetCaption(e.Label); } ColumnSpecs = columns; }