private void timer1_Tick(object sender, EventArgs e) { List <string> criticalCounters = new List <string>(); for (int i = 0; i < counters.Count; i++) { PerfCounter counter = counters[i]; if (counter.check() && isSendMode) { criticalCounters.Add(counter.getCategory() + "=1"); } else { dataGridView1.Rows[i].Cells[3].Value = counter.getLastValue(); dataGridView1.Rows[i].Cells[4].Value = counter.getAvg(); } } if (criticalCounters.Count > 0) { sendReportRequest(string.Join(" ", criticalCounters.ToArray())); clearCountersValues(); } }
private void clearCountersValues() { for (int i = 0; i < counters.Count; i++) { PerfCounter counter = counters[i]; counter.reset(); dataGridView1.Rows[i].Cells[3].Value = counter.getLastValue(); dataGridView1.Rows[i].Cells[4].Value = counter.getAvg(); } }