public void AddChecksum(List <string> args) { ManualResetEvent[] doneEvents = new ManualResetEvent[1]; CalcSUM[] CalcSUMArray = new CalcSUM[1]; var index = dataGridView_Files.Rows.Add(); dataGridView_Files.Rows[index].Cells[0].Value = args[index]; dataGridView_Files.Rows[index].Cells[1].Value = "0%"; doneEvents[0] = new ManualResetEvent(false); CalcSUM f = new CalcSUM(dataGridView_Files.Rows[index], doneEvents[0]); CalcSUMArray[0] = f; ThreadPool.QueueUserWorkItem(f.ThreadPoolCallback, index); }
private void Form_MultiFiles_Shown(object sender, EventArgs e) { ManualResetEvent[] doneEvents = new ManualResetEvent[files.Count]; CalcSUM[] CalcSUMArray = new CalcSUM[files.Count]; for (int a = 0; a < files.Count; a++) { var index = dataGridView_Files.Rows.Add(); dataGridView_Files.Rows[index].Cells[0].Value = files[a]; dataGridView_Files.Rows[index].Cells[1].Value = "0%"; doneEvents[a] = new ManualResetEvent(false); CalcSUM f = new CalcSUM(dataGridView_Files.Rows[index], doneEvents[a]); CalcSUMArray[a] = f; ThreadPool.QueueUserWorkItem(f.ThreadPoolCallback, a); } }