protected void OnBtnCheckInVirusTotalClicked(object sender, EventArgs e) { if (treeFiles.SelectedItem == null) { return; } DbFile file = Workers.GetDBFile(((DbFile)treeFiles.SelectedItem).Sha256); outIter = (DbFile)treeFiles.SelectedItem; if (file == null) { MessageBox.Show("Cannot get file from database", MessageBoxType.Error); return; } treeFiles.Enabled = false; btnToggleCrack.Enabled = false; btnScanWithClamd.Enabled = false; btnCheckInVirusTotal.Enabled = false; prgProgressFiles1.Visible = true; lblProgressFiles1.Visible = true; Workers.Failed += VirusTotalFailed; Workers.ScanFinished += VirusTotalFinished; Workers.UpdateProgress += UpdateVirusProgress; lblProgressFiles1.Text = "Scanning file with VirusTotal."; prgProgressFiles1.Indeterminate = true; thdScanFile = new Thread(() => Workers.VirusTotalFileFromRepo(file)); thdScanFile.Start(); }
protected void OnBtnCheckInVirusTotalClicked(object sender, EventArgs e) { if (!treeFiles.Selection.GetSelected(out outIter)) { return; } DbFile file = Workers.GetDBFile((string)fileView.GetValue(outIter, 0)); if (file == null) { MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Cannot get file from database"); dlgMsg.Run(); dlgMsg.Destroy(); return; } treeFiles.Sensitive = false; btnToggleCrack.Sensitive = false; btnScanWithClamd.Sensitive = false; btnCheckInVirusTotal.Sensitive = false; prgProgressFiles1.Visible = true; Workers.Failed += VirusTotalFailed; Workers.ScanFinished += VirusTotalFinished; Workers.UpdateProgress += UpdateVirusProgress; prgProgressFiles1.Text = "Scanning file with VirusTotal."; thdPulseProgress = new Thread(() => { while (true) { Application.Invoke(delegate { prgProgressFiles1.Pulse(); }); Thread.Sleep(66); } }); thdPulseProgress.Start(); thdScanFile = new Thread(() => Workers.VirusTotalFileFromRepo(file)); thdScanFile.Start(); }