public frm_LRInstall(string Hostname) { InitializeComponent(); ComputerName = Hostname; lbl_CN.Text = ComputerName; sensorID = BEFunctions.GetSensorIdForHost(ComputerName); lbl_SensorID.Text = sensorID.ToString(); lbl_LR_Status.Text = "Disconnected"; }
private async void bt_Load_Click(object sender, EventArgs e) { try { var sensorId = BEFunctions.GetSensorIdForHost(ComputerName); if (sensorId == -1) { MessageBox.Show(String.Format("A matching sensor could not be found for the Sensor Hostname: '{0}'", ComputerName)); return; } using (cancelSource = new CancellationTokenSource()) { var resultCount = 0; var totalCount = 0; do { resultCount = await cb.UpdateFilesBatch(filesystem, sensorId, totalCount, 500, cancelSource.Token); if (resultCount < 0) { return; } totalCount += resultCount; lbl_Counts.Text = totalCount.ToString(); }while (resultCount > 0); lbl_Counts.Text = totalCount.ToString(); } MessageBox.Show("Done."); PopulateTree(tv_Files, filesystem); } catch (Exception ex) { MessageBox.Show(String.Format("An error occured: {0}", ex.ToString())); } }