private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { PreCheckHostRow preCheckHostRow = dataGridView1.Rows[e.RowIndex] as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Enabled && e.ColumnIndex == 2) { ExecuteSolution(preCheckHostRow); } }
public override bool Equals(object obj) { PreCheckHostRow other = obj as PreCheckHostRow; if (other != null && other.Problem != null && _problem != null) { return(_problem.CompareTo(other.Problem) == 0); } return(false); }
private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter && dataGridView1.CurrentCell != null) { PreCheckHostRow preCheckHostRow = dataGridView1.CurrentCell.OwningRow as PreCheckHostRow; int columnIndex = dataGridView1.CurrentCell.ColumnIndex; if (preCheckHostRow != null && preCheckHostRow.Enabled && columnIndex == 2) { ExecuteSolution(preCheckHostRow); } } }
private void dataGridView1_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { PreCheckHostRow preCheckHostRow = dataGridView1.Rows[e.RowIndex] as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Enabled && e.ColumnIndex == 2 && !string.IsNullOrEmpty(preCheckHostRow.Solution)) { Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } }
private void worker_DoWork(object sender, DoWorkEventArgs e) { lock (_lock) { Program.Invoke(this, () => { dataGridView1.Rows.Clear(); progressBar1.Value = 0; }); Pool_patch patch = e.Argument as Pool_patch; List <KeyValuePair <string, List <Check> > > checks = GenerateChecks(patch); _numberChecks = checks.Count; for (int i = 0; i < checks.Count; i++) { if (_worker.CancellationPending) { e.Cancel = true; return; } List <Check> checkGroup = checks[i].Value; PreCheckHeaderRow headerRow = new PreCheckHeaderRow(string.Format(Messages.PATCHING_WIZARD_PRECHECK_STATUS, checks[i].Key)); _worker.ReportProgress(5, headerRow); PreCheckResult precheckResult = PreCheckResult.OK; for (int j = 0; j < checkGroup.Count; j++) { if (_worker.CancellationPending) { e.Cancel = true; return; } Check check = checkGroup[j]; PreCheckHostRow row = ExecuteCheck(check); if (precheckResult != PreCheckResult.Failed && row.Problem != null) { precheckResult = row.IsProblem ? PreCheckResult.Failed : PreCheckResult.Warning; } _worker.ReportProgress(PercentageSelectedServers(j + 1), row); } lock (_update_grid_lock) { headerRow.UpdateDescription(precheckResult); } } } }
public override bool EnableNext() { bool problemsFound = false; foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckHostRow = row as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.IsProblem) { problemsFound = true; break; } } UpdateControls(problemsFound); return(!IsCheckInProgress && !IsResolveActionInProgress && !problemsFound); }
public override bool EnableNext() { bool problemsFound = false; foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckHostRow = row as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.IsProblem) { problemsFound = true; break; } } bool result = _worker != null && !_worker.IsBusy && !problemsFound; panelErrorsFound.Visible = problemsFound; return(result); }
private void ExecuteSolution(PreCheckHostRow preCheckHostRow) { bool cancelled; resolvePrechecksAction = preCheckHostRow.Problem.GetSolutionAction(out cancelled); if (resolvePrechecksAction != null) { // disable all problems foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckRow = row as PreCheckHostRow; if (preCheckRow != null && preCheckRow.Problem != null) { preCheckRow.Enabled = false; } } StartResolvePrechecksAction(); } else { if (preCheckHostRow.Problem is WarningWithInformationUrl) { (preCheckHostRow.Problem as WarningWithInformationUrl).LaunchUrlInBrowser(); } else if (preCheckHostRow.Problem is ProblemWithInformationUrl) { (preCheckHostRow.Problem as ProblemWithInformationUrl).LaunchUrlInBrowser(); } else if (!cancelled) { using (var dlg = new InformationDialog(string.Format(Messages.PATCHING_WIZARD_SOLVE_MANUALLY, preCheckHostRow.Problem.Description).Replace("\\n", "\n")) { WindowTitle = Messages.PATCHINGWIZARD_PRECHECKPAGE_TEXT }) { dlg.ShowDialog(this); } } } }
private void buttonResolveAll_Click(object sender, EventArgs e) { List <AsyncAction> actions = new List <AsyncAction>(); foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckHostRow = row as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Problem != null) { bool cancelled; AsyncAction action = preCheckHostRow.Problem.SolveImmediately(out cancelled); if (action != null) { preCheckHostRow.Enabled = false; actions.Add(action); } } } resolvePrechecksAction = new ParallelAction(Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.COMPLETED, actions, true, false); StartResolvePrechecksAction(); }
private void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled) { OnPageUpdated(); } progressBar1.Value = 100; bool problemsFound = false; foreach (PreCheckGridRow row in dataGridView1.Rows) { PreCheckHostRow hostRow = row as PreCheckHostRow; //CA-65508: if the problem cannot be solved immediately there's no point in enabling the Resolve All button if (hostRow != null && hostRow.IsProblem && !string.IsNullOrEmpty(hostRow.Solution)) { problemsFound = true; break; } } buttonResolveAll.Enabled = problemsFound; buttonReCheckProblems.Enabled = true; }
public override bool EnableNext() { // CA-65508: if the problem cannot be solved immediately there's no point in // enabling the Resolve All button // CA-136211: Changed the code below to enable the Resolve All button only // when there is at least one problem and all the problems have solution/fix. bool problemsFound = false; bool allFixable = true; foreach (PreCheckGridRow row in dataGridView1.Rows) { PreCheckHostRow hostRow = row as PreCheckHostRow; if (hostRow != null && hostRow.IsProblem) { problemsFound = true; if (!hostRow.IsFixable) { allFixable = false; break; } } } bool actionInProgress = IsResolveActionInProgress; bool checkInProgress = IsCheckInProgress; buttonResolveAll.Enabled = !actionInProgress && !checkInProgress && problemsFound && allFixable; buttonReCheckProblems.Enabled = !actionInProgress && !checkInProgress; checkBoxViewPrecheckFailuresOnly.Enabled = !actionInProgress && !checkInProgress; labelProgress.Visible = actionInProgress || checkInProgress; pictureBoxIssues.Visible = labelIssues.Visible = problemsFound && !actionInProgress && !checkInProgress; return(!checkInProgress && !actionInProgress && !problemsFound); }
private void buttonResolveAll_Click(object sender, EventArgs e) { List <AsyncAction> actions = new List <AsyncAction>(); foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckHostRow = row as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Problem != null) { bool cancelled; AsyncAction action = preCheckHostRow.Problem.SolveImmediately(out cancelled); if (action != null) { actions.Add(action); } } } var multipleAction = new ParallelAction(Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.COMPLETED, actions, true, false); _progressDialog = new ActionProgressDialog(multipleAction, ProgressBarStyle.Blocks); _progressDialog.ShowDialog(this); Program.Invoke(Program.MainWindow, RefreshRechecks); }
private void ExecuteSolution(PreCheckHostRow preCheckHostRow) { bool cancelled; AsyncAction action = preCheckHostRow.Problem.SolveImmediately(out cancelled); if (action != null) { action.Completed += action_Completed; _progressDialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks); _progressDialog.ShowDialog(this); } else { if (preCheckHostRow.Problem is WarningWithInformationUrl) (preCheckHostRow.Problem as WarningWithInformationUrl).LaunchUrlInBrowser(); else if (preCheckHostRow.Problem is ProblemWithInformationUrl) (preCheckHostRow.Problem as ProblemWithInformationUrl).LaunchUrlInBrowser(); else if (!cancelled) new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Information, string.Format(Messages.PATCHING_WIZARD_SOLVE_MANUALLY, preCheckHostRow.Problem.Description).Replace("\\n", "\n"), Messages.PATCHINGWIZARD_PRECHECKPAGE_TEXT)).ShowDialog(this); } }
private void ExecuteSolution(PreCheckHostRow preCheckHostRow) { bool cancelled; resolvePrechecksAction = preCheckHostRow.Problem.SolveImmediately(out cancelled); if (resolvePrechecksAction != null) { // disable all problems foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckRow = row as PreCheckHostRow; if (preCheckRow != null && preCheckRow.Problem != null) { preCheckRow.Enabled = false; } } StartResolvePrechecksAction(); } else { if (preCheckHostRow.Problem is WarningWithInformationUrl) (preCheckHostRow.Problem as WarningWithInformationUrl).LaunchUrlInBrowser(); else if (preCheckHostRow.Problem is ProblemWithInformationUrl) (preCheckHostRow.Problem as ProblemWithInformationUrl).LaunchUrlInBrowser(); else if (!cancelled) using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Information, string.Format(Messages.PATCHING_WIZARD_SOLVE_MANUALLY, preCheckHostRow.Problem.Description).Replace("\\n", "\n"), Messages.PATCHINGWIZARD_PRECHECKPAGE_TEXT))) { dlg.ShowDialog(this); } } }