void _stats_StatUpdated(object sender, StatsUpdatedEventArgs a) { dataGridViewStats.Invoke(new MethodInvoker(delegate() { int iUpdateRow = -1; for (int i = 0; i < dataGridViewStats.Rows.Count; i++) { if (((string)dataGridViewStats[0, i].Value) == a.StatDescription) { iUpdateRow = i; break; } } if (iUpdateRow < 0) { dataGridViewStats.Rows.Add(); iUpdateRow = dataGridViewStats.Rows.Count - 1; dataGridViewStats[0, iUpdateRow].Value = a.StatDescription; } dataGridViewStats[1, iUpdateRow].Value = a.Average; dataGridViewStats[2, iUpdateRow].Value = a.Minimum; dataGridViewStats[3, iUpdateRow].Value = a.Maximum; dataGridViewStats[4, iUpdateRow].Value = a.Total; })); }
protected virtual void OnStatUpdated(StatsUpdatedEventArgs a) { StatsUpdatedEventHandler handler = StatUpdated; if (handler != null) { handler(this, a); } }