/// <summary> /// Trigle the Import action. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdImport_Click(object sender, EventArgs e) { try { if (cmdImport.Text == "Import") { lbCounter.Text = "0 / 0"; _is_running = true; cmdImport.Text = "Pause"; string ui_selections = cmbLists.SelectedItem.ToString().Trim() + ";" + cmbSheets.SelectedItem.ToString().Trim(); _update_message = new ui_call_back(update_message); _update_counter = new ui_call_back(update_record_count); ThreadPool.QueueUserWorkItem(new WaitCallback(import_excel_to_sharepoint_list), ui_selections); } else { _is_running = false; cmdImport.Text = "Import"; numericUpDown1.Value = _count; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }