public AutomaticBackgroundThread(IEnumerable<Host> mastersToUpgrade, IDictionary<Host, List<PlanAction>> planActions, PlanAction revertAction) { _planActions = planActions; _mastersToUpgrade = mastersToUpgrade; _revertAction = revertAction; _bw = new Thread(BworkerDoWork) { IsBackground = true }; }
protected void OnReportRunning(PlanAction planAction, Host host) { if (ReportRunning != null) ReportRunning(planAction, host); }
protected void OnReportException(Exception ex, PlanAction planAction, Host host) { if (ReportException != null) ReportException(ex, planAction, host); }
private void ReportRunning(PlanAction planAction, Host host) { Program.BeginInvoke(this, () => { progressBar1.Value = progressBar1.Value < 100 ? progressBar1.Value + 2 : progressBar1.Value; var row = planAction is UnwindProblemsAction ? FindRow(null) : FindRow(host); if (row != null) row.UpdateStatus(HostUpgradeState.Upgrading, planAction.TitlePlan); }); }
private static void InitializePlanAction(UpdateProgressBackgroundWorker bgw, PlanAction action) { if (action is IAvoidRestartHostsAware) { var avoidRestartAction = action as IAvoidRestartHostsAware; avoidRestartAction.AvoidRestartHosts = bgw.AvoidRestartHosts; } }
private void ReportException(Exception exception, PlanAction planAction, Host host) { Program.Invoke(this, () => { if (host != null && !host.enabled) new EnableHostAction(host, false, AddHostToPoolCommand.EnableNtolDialog).RunExternal(host.Connection.Session); }); Program.BeginInvoke(this, () => { var row = planAction is UnwindProblemsAction ? FindRow(null) : FindRow(host); row.UpdateStatus(HostUpgradeState.Error, exception.Message); UpgradeProgress(row.Index + 1); }); }
private void planAction_StatusChanged(PlanAction plan, Host senderHost) { if(senderHost == null || plan == null) return; List<DataGridViewRowUpgrade> rowsForHost = (from DataGridViewRowUpgrade row in dataGridView1.Rows where row.RowIsForHost(senderHost) select row).ToList(); foreach (DataGridViewRowUpgrade row in rowsForHost) { DataGridViewRowUpgrade closureRow = row; Program.Invoke(this, () => closureRow.UpdateStatus(HostUpgradeState.Upgrading, plan.Status)); } }
public ReportExceptionArgs(Exception excep, PlanAction action, Host host) { Exception = excep; Action = action; Host = host; }
public ReportRunningArgs(PlanAction action, Host host) { Host = host; Action = action; }
public ReportRevertDoneArgs(PlanAction planAction) { PlanAction = planAction; }