private void AddSeriesRows() { labSeries.Text = string.Empty; strzNaSerie = 5; int skip = 5; for (int i = 0; i < 3; i++) { if (i == 2) { strzNaSerie = 14; } var serie = Shots.Skip(i * skip).Take(strzNaSerie).ToList(); serie.ForEach(w => w.No = 1 + Shots.FindIndex(f => f.Time == w.Time)); if (flPanelSeries.Controls.Count > i) { //uzupelniaj SeriesRow sr = (SeriesRow)flPanelSeries.Controls[i]; sr.shotsSerie = serie; sr.DrawNFill(); } else { //dodaj AddGridAndPictureOfSeries(serie); } var sum = serie.Sum(a => a.Value); labSeries.Text = labSeries.Text + " " + sum.ToString("F1"); } //for (var w = 3; w < flPanelSeries.Controls.Count; w++) //{ // flPanelSeries.Controls.Remove(flPanelSeries.Controls[w]); //} }
private void AddSeriesRows() { int series = Shots.Count() / strzNaSerie; if (series * strzNaSerie < Shots.Count()) { series++; } labSeries.Text = string.Empty; for (int i = 0; i < series; i++) { var serie = Shots.Skip(i * strzNaSerie).Take(strzNaSerie).ToList(); serie.ForEach(w => w.No = 1 + Shots.FindIndex(f => f.Time == w.Time)); if (flPanelSeries.Controls.Count > i) { //uzupelniaj SeriesRow sr = (SeriesRow)flPanelSeries.Controls[i]; sr.shotsSerie = serie; sr.DrawNFill(); } else { //dodaj AddGridAndPictureOfSeries(serie); } var sum = serie.Sum(a => a.SingleValue); labSeries.Text = labSeries.Text + " " + sum.ToString(); } for (var w = series; w < flPanelSeries.Controls.Count; w++) { flPanelSeries.Controls.Remove(flPanelSeries.Controls[w]); } }