private void table_SelectionChanged(object sender, EventArgs e) { if (worker.IsBusy) { return; } //select all rows that have the same machine names that are already selected. List <string> selected_machines = getTableAsList().Where(row => row[SELECTED] == "" + true).Select(row => row[MACHINE]).Distinct().ToList(); Console.WriteLine("----------------------------------------------------------------------\n\n" + "Selected machines: " + (selected_machines.Count > 0 ? selected_machines.Aggregate((x, y) => x + ", " + y) : "none.") + "\n\n" + "----------------------------------------------------------------------"); foreach (DataGridViewRow row in table.Rows) { if (selected_machines.Contains(row.Cells[COLUMNS[MACHINE]].Value)) { row.Selected = true; } } //start the scan job if requested if (selected_machines.Count > 0 && request_Go) { Console.WriteLine("----------------------------------------------------------------------\n\n" + "Start requested...\n\n" + "----------------------------------------------------------------------"); Go.PerformClick(); } request_Go = false; }
private void NavigationTxtBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Go.PerformClick(); } }