void CheckProcess(int percentDone, int unweightedPercent, string extraStatus, ProgressStatus status, Object payload) { if (IsDisposed) return; // update bottom status if (!string.IsNullOrEmpty(extraStatus) && extraStatus != panelDisplaying.ProgressStatus) panelDisplaying.ProgressStatus = extraStatus; if (status == ProgressStatus.Success || status == ProgressStatus.Failure) { installUpdate.Rollback -= ChangeRollback; installUpdate.ProgressChanged -= CheckProcess; } if (status == ProgressStatus.Success) { List<FileInfo> files = null; List<Process> rProcesses = null; var objects = payload as object[]; if (objects != null) { files = (List<FileInfo>)(objects)[0]; rProcesses = (List<Process>)(objects)[1]; } if (rProcesses != null) //if there are some processes need closing { // remove processes that have exited since last checked for (int i = 0; i < rProcesses.Count; i++) { try { if (rProcesses[i].HasExited) rProcesses.RemoveAt(i); } catch { } } // only continue if processes are still running if (rProcesses.Count > 0) { // show myself, make topmost Show(); TopMost = true; TopMost = false; // start the close processes form using (Form proc = new frmProcesses(files, rProcesses, clientLang)) { if (proc.ShowDialog() == DialogResult.Cancel) { // cancel the update process CancelUpdate(true, false); return; } } } } // processes closed, continue on update.CurrentlyUpdating += 1; InstallUpdates(update.CurrentlyUpdating); } if (status == ProgressStatus.Failure) { if (isCancelled) { Close(); return; } error = clientLang.GeneralUpdateError; errorDetails = ((Exception)payload).Message; ShowFrame(Frame.Error); } }
void CheckProcess(int percentDone, int unweightedPercent, string extraStatus, ProgressStatus status, Object payload) { if (IsDisposed) { return; } // update bottom status if (!string.IsNullOrEmpty(extraStatus) && extraStatus != panelDisplaying.ProgressStatus) { panelDisplaying.ProgressStatus = extraStatus; } if (status == ProgressStatus.Success || status == ProgressStatus.Failure) { installUpdate.Rollback -= ChangeRollback; installUpdate.ProgressChanged -= CheckProcess; } if (status == ProgressStatus.Success) { List <FileInfo> files = null; List <Process> rProcesses = null; var objects = payload as object[]; if (objects != null) { files = (List <FileInfo>)(objects)[0]; rProcesses = (List <Process>)(objects)[1]; } if (rProcesses != null) //if there are some processes need closing { // remove processes that have exited since last checked for (int i = 0; i < rProcesses.Count; i++) { try { if (rProcesses[i].HasExited) { rProcesses.RemoveAt(i); } } catch { } } // only continue if processes are still running if (rProcesses.Count > 0) { // show myself, make topmost Show(); TopMost = true; TopMost = false; // start the close processes form using (Form proc = new frmProcesses(files, rProcesses, clientLang)) { if (proc.ShowDialog() == DialogResult.Cancel) { // cancel the update process CancelUpdate(true, false); return; } } } } // processes closed, continue on update.CurrentlyUpdating += 1; InstallUpdates(update.CurrentlyUpdating); } if (status == ProgressStatus.Failure) { if (isCancelled) { Close(); return; } error = clientLang.GeneralUpdateError; errorDetails = ((Exception)payload).Message; ShowFrame(Frame.Error); } }