private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { //Intall selected products one by one foreach (var productpath in _pim.SelectedProducts) { using (var mutex = new System.Threading.Mutex(false, "mutex01")) { mutex.WaitOne(); try { // Start installation process of a selected product Process.Start(productpath); // Todo : calculation of a product installation % backgroundWorker1.ReportProgress(1); } catch (System.Threading.AbandonedMutexException ex) // Current thread owns the mutex, and must release it. { Console.WriteLine("Exception on return from WaitOne." + "\r\n\tMessage: {0}", ex.Message); } finally { mutex.ReleaseMutex(); _installedproductcount += 1; } } } } private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { progressBar1.Value = e.ProgressPercentage; label3.Text = e.ProgressPercentage.ToString() + "%"; } private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { progressBar1.Value = 0; label3.Text = "0"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)