public void UpdateDescription(PreCheckResult precheckResult)
            {
                string result;

                switch (precheckResult)
                {
                case PreCheckResult.OK:
                    result = Messages.GENERAL_STATE_OK;
                    break;

                case PreCheckResult.Info:
                    result = Messages.INFORMATION;
                    break;

                case PreCheckResult.Warning:
                    result = Messages.WARNING;
                    break;

                default:
                    result = Messages.FAILED;
                    break;
                }

                _descriptionCell.Value = string.Format("{0} {1}", description, result);
            }
Example #2
0
            public void UpdateDescription(PreCheckResult precheckResult)
            {
                string result = precheckResult == PreCheckResult.OK
                                    ? Messages.GENERAL_STATE_OK
                                    : precheckResult == PreCheckResult.Warning ? Messages.WARNING : Messages.FAILED;

                _descriptionCell.Value = string.Format("{0} {1}", description, result);
            }
Example #3
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            lock (_lock)
            {
                Program.Invoke(this, () =>
                {
                    dataGridView1.Rows.Clear();
                    progressBar1.Value = 0;
                    labelProgress.Text = Messages.PATCHING_WIZARD_RUNNING_PRECHECKS;
                });
                Pool_patch  patch  = e.Argument as Pool_patch;
                Pool_update update = e.Argument as Pool_update;

                LivePatchCodesByHost = new Dictionary <string, livepatch_status>();

                List <KeyValuePair <string, List <Check> > > checks = update != null?GenerateChecks(update) : GenerateChecks(patch); //patch is expected to be null for RPU

                _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];
                        foreach (PreCheckHostRow row in ExecuteCheck(check))
                        {
                            if (precheckResult != PreCheckResult.Failed && row.Problem != null)
                            {
                                precheckResult = row.PrecheckResult;
                            }
                            _worker.ReportProgress(PercentageSelectedServers(j + 1), row);
                        }
                    }

                    lock (_update_grid_lock)
                    {
                        headerRow.UpdateDescription(precheckResult);
                    }
                }
            }
        }
        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);
                    }
                }
            }
        }
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            var bgw = sender as BackgroundWorker;

            if (bgw == null)
            {
                return;
            }

            lock (_lock)
            {
                bgw.ReportProgress(0, null);
                Program.Invoke(this, () =>
                {
                    dataGridView1.Rows.Clear();
                    labelProgress.Text = Messages.PATCHING_WIZARD_RUNNING_PRECHECKS;
                    OnPageUpdated();
                });
                Pool_patch  patch  = e.Argument as Pool_patch;
                Pool_update update = e.Argument as Pool_update;

                LivePatchCodesByHost = new Dictionary <string, livepatch_status>();

                // Note: represent the groups as list so as to enforce the order of checks;
                // a dictionary that looks sensible from a first look is not guranteed to
                // keep the order, especially if items are removed (although not the case here)
                var groups = update != null?GenerateChecks(update) : GenerateChecks(patch);   //patch is expected to be null for RPU

                int totalChecks    = groups.Sum(c => c.Value == null ? 0 : c.Value.Count);
                int doneCheckIndex = 0;

                allRows.Clear();

                foreach (var group in groups)
                {
                    if (bgw.CancellationPending)
                    {
                        e.Cancel = true;
                        return;
                    }

                    var headerRow = new PreCheckHeaderRow(string.Format(Messages.PATCHING_WIZARD_PRECHECK_STATUS, group.Key));
                    //multiply with 100 first, otherwise the quotient is 0
                    bgw.ReportProgress(doneCheckIndex * 100 / totalChecks, headerRow);

                    PreCheckResult precheckResult = PreCheckResult.OK;
                    var            checks         = group.Value;

                    foreach (var check in checks)
                    {
                        if (bgw.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }

                        var rows = ExecuteCheck(check);
                        doneCheckIndex++;

                        foreach (PreCheckHostRow row in rows)
                        {
                            if (precheckResult != PreCheckResult.Failed && row.Problem != null)
                            {
                                precheckResult = row.PrecheckResult;
                            }

                            //multiply with 100 first, otherwise the quotient is 0
                            bgw.ReportProgress(doneCheckIndex * 100 / totalChecks, row);
                        }
                    }

                    lock (_update_grid_lock)
                    {
                        headerRow.UpdateDescription(precheckResult);
                    }
                }
            }
        }
            public void UpdateDescription(PreCheckResult precheckResult)
            {
                string result = precheckResult == PreCheckResult.OK
                                    ? Messages.GENERAL_STATE_OK
                                    : precheckResult == PreCheckResult.Warning ? Messages.WARNING : Messages.FAILED;

                _descriptionCell.Value = string.Format("{0} {1}", description, result);
            }
            public void UpdateDescription(PreCheckResult precheckResult)
            {
                string result;
                switch (precheckResult)
                {
                    case PreCheckResult.OK:
                        result = Messages.GENERAL_STATE_OK;
                        break;
                    case PreCheckResult.Info:
                        result = Messages.INFORMATION;
                        break;
                    case PreCheckResult.Warning:
                        result = Messages.WARNING;
                        break;
                    default:
                        result = Messages.FAILED;
                        break;
                }

                _descriptionCell.Value = string.Format("{0} {1}", description, result);
            }