async Task AutoDispatch(IWebDriver driver, AppSetting appSetting, bool dispatch, Main form) { List <Tuple <string, string, string, string, string, string> > mainQueue; List <Tuple <string, string, string, string, string, string> > Generics; while (dispatch) { form.dispatchLabel.Invoke(new Action(() => form.dispatchLabel.Visible = true)); try { ExcelImport importer = new ExcelImport(); available = importer.CheckConsultants(appSetting.GetSpreadhseet()); mainQueue = CheckQueue(driver, appSetting.GetMainQueueTab(), Consultants); foreach (var item in mainQueue) { Consultants.Add(item.Item6); } await Populate(driver, form.mainQueueListView, mainQueue); Generics = CheckQueue(driver, appSetting.GetGenericsTab(), Consultants); await Populate(driver, form.GenericsListView, Generics); Consultants.Clear(); available.Clear(); } catch (System.Threading.ThreadAbortException ex) { MessageBox.Show(ex.StackTrace); dispatch = false; } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); dispatch = false; } Thread.Sleep(appSetting.GetInterval()); } form.dispatchLabel.Invoke(new Action(() => form.dispatchLabel.Visible = false)); }