private void PopulateFlipHistory(Result result) { dataGridViewHistory.Invoke((Action) delegate { if (dataGridViewHistory.RowCount > 0) { dataGridViewHistory.Rows.Clear(); dataGridViewHistory.Refresh(); } } ); if (result.GetFlipHistory().IsFilled()) { FlipHistory flipHistory = result.GetFlipHistory(); int index = 1; int headsCount = 0; int tailsCount = 0; int total = 0; foreach (FlipHistory.FaceCount faceCount in flipHistory) { headsCount = faceCount.IsHeads() ? headsCount + faceCount.GetCount() : headsCount; tailsCount = !faceCount.IsHeads() ? tailsCount + faceCount.GetCount() : tailsCount; total = headsCount + tailsCount; dataGridViewHistory.Invoke((Action) delegate { dataGridViewHistory.Rows.Add(index, faceCount.GetCount(), faceCount.GetFace(), headsCount, tailsCount, total); } ); index++; } } }
public void AddHistory(FlipHistory flipHistory) { this.flipHistory = flipHistory; }