private void SetPenalties(List <DataGridViewRow> penalties) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.dataGridView1.InvokeRequired) { SetPenaltiesCallback d = new SetPenaltiesCallback(SetPenalties); this.Invoke(d, new object[] { penalties }); } else { dataGridView1.Rows.Clear(); dataGridView1.Rows.AddRange(penalties.ToArray()); } }
private void SetPenalties(List<ListViewItem> penalties) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.listViewPenalty.InvokeRequired) { SetPenaltiesCallback d = new SetPenaltiesCallback(SetPenalties); this.Invoke(d, new object[] { penalties }); } else { listViewPenalty.Items.Clear(); listViewPenalty.Items.AddRange(penalties.ToArray()); } }