private void btnInsert_Click(object sender, EventArgs e) { var newSegment = new Segment(""); Run.ImportBestSegment(runGrid.CurrentRow.Index); for (var x = Run.GetMinSegmentHistoryIndex() + 1; x <= Run.AttemptHistory.Count; x++) newSegment.SegmentHistory.Add(new IndexedTime(default(Time), x)); SegmentList.Insert(runGrid.CurrentRow.Index, newSegment); //TODO: Auto Delete? //SegmentList[runGrid.CurrentRow.Index].BestSegmentTime = null; runGrid.ClearSelection(); runGrid.CurrentCell = runGrid.Rows[runGrid.CurrentRow.Index - 1].Cells[runGrid.CurrentCell.ColumnIndex]; runGrid.CurrentCell.Selected = true; Fix(); SegmentRemovedOrAdded(null, null); }
private void btnAdd_Click(object sender, EventArgs e) { var newSegment = new Segment(""); if (runGrid.CurrentRow.Index + 1 < Run.Count) Run.ImportBestSegment(runGrid.CurrentRow.Index + 1); var maxIndex = Run.AttemptHistory.Select(x => x.Index).DefaultIfEmpty(0).Max(); for (var x = Run.GetMinSegmentHistoryIndex(); x <= maxIndex; x++) newSegment.SegmentHistory.Add(x, default(Time)); SegmentList.Insert(runGrid.CurrentRow.Index + 1, newSegment); runGrid.ClearSelection(); runGrid.CurrentCell = runGrid.Rows[runGrid.CurrentRow.Index + 1].Cells[runGrid.CurrentCell.ColumnIndex]; runGrid.CurrentCell.Selected = true; Fix(); SegmentRemovedOrAdded(null, null); }
public void AddSegment(string name, Time pbSplitTime = default(Time), Time bestSegmentTime = default(Time), Image icon = null, Time splitTime = default(Time), IList<IIndexedTime> segmentHistory = null) { var segment = new Segment(name, pbSplitTime, bestSegmentTime, icon, splitTime); if (segmentHistory != null) segment.SegmentHistory = segmentHistory; Add(segment); }