private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            puf_popUpForm popup  = (puf_popUpForm)e.UserState;
            int           stepId = e.ProgressPercentage;

            if (puf_popUpForm.isBackgroundWorkerCancelled == true)
            {
                backgroundWorker1.CancelAsync();
                puf_popUpForm.isBackgroundWorkerCancelled = false; // reset
            }
            else
            {
                FeedbackSteps.TryGetValue(stepId, out string feedbackText);

                popup.lb_ProgressFeedback.Items.Add(feedbackText);
                popup.lb_ProgressFeedback.SelectedIndex = popup.lb_ProgressFeedback.Items.Count - 1;
                popup.lb_ProgressFeedback.SelectedIndex = -1;

                if (!(popup.pb_progressBar.Value >= popup.pb_progressBar.Maximum))
                {
                    popup.pb_progressBar.PerformStep();
                }

                popup.Refresh();
            }

            if (stepId == FeedbackSteps.Keys.Last <int>())
            {
                popup.Dispose();
                popup.Close();
            }
        }
        private void bt_runOsDiagTool_Click(object sender, EventArgs e, OSDiagToolConf.ConfModel.strConfModel configurations)
        {
            var           formConfigurations = new OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel();
            List <string> tableNameHelper    = new List <string>();

            if (tb_iptSaUsername.Text.Equals("") || tb_iptSaPwd.Text.Equals(""))  // if no input is provided in user or pwd, then DBTroubleshoot doesn't run
            {
                cb_dbTroubleshoot.Checked = false;
            }

            formConfigurations.saUser          = tb_iptSaUsername.Text.ToString();
            formConfigurations.saPwd           = tb_iptSaPwd.Text.ToString();
            formConfigurations.iisLogsNrDays   = Convert.ToInt32(nud_iisLogsNrDays.Value);
            formConfigurations.osLogTopRecords = Convert.ToInt32(nud_topLogs.Value);
            foreach (object item in lb_metamodelTables.Items)
            {
                tableNameHelper.Add(item.ToString());
            }

            formConfigurations.metamodelTables = tableNameHelper;

            Dictionary <string, bool> dictHelper = new Dictionary <string, bool>()
            {
                { _tdIis, cb_iisThreads.Checked },
                { _tdOsServices, cb_osServicesThreads.Checked },
                { _mdIis, cb_iisMemDumps.Checked },
                { _mdOsServices, cb_osMemDumps.Checked },
                { _slEvt, cb_EvtViewerLogs.Checked },
                { _slIisLogs, cb_iisAccessLogs.Checked },
                { _diMetamodel, cb_dbPlatformMetamodel.Checked },
                { _diDbTroubleshoot, cb_dbTroubleshoot.Checked },
                { _plPlatformLogs, cb_platformLogs.Checked },
                { _plPlatformAndServerFiles, cb_platformAndServerFiles.Checked },
            };

            formConfigurations.cbConfs = dictHelper;

            var configurationsHelper = new DataHelperClass.strConfigurations();

            configurationsHelper.FormConfigurations = new OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel();
            configurationsHelper.FormConfigurations = formConfigurations;

            int           numberOfSteps = OSDiagToolHelper.CountSteps(configurationsHelper.FormConfigurations.cbConfs);
            puf_popUpForm popup         = new puf_popUpForm(puf_popUpForm._feedbackWaitType, OsDiagForm._waitMessage, totalSteps: numberOfSteps + 2); // totalSteps + 2 for the zipping and pop up close

            popup.Show();
            popup.Refresh();
            configurationsHelper.popup = popup;

            configurationsHelper.ConfigFileConfigurations = new OSDiagToolConf.ConfModel.strConfModel();
            configurationsHelper.ConfigFileConfigurations = configurations;


            backgroundWorker1.RunWorkerAsync(configurationsHelper);
            Cursor = Cursors.Arrow;
        }
Example #3
0
        public static void ChangeFeedbackLabelAndProgressBar(puf_popUpForm popUpForm, string labelText)
        {
            popUpForm.lb_ProgressFeedback.Items.Add(labelText);
            popUpForm.lb_ProgressFeedback.SelectedIndex = popUpForm.lb_ProgressFeedback.Items.Count - 1;
            popUpForm.lb_ProgressFeedback.SelectedIndex = -1;

            if (!(popUpForm.pb_progressBar.Value >= popUpForm.pb_progressBar.Maximum))
            {
                popUpForm.pb_progressBar.PerformStep();
            }

            popUpForm.Refresh();
        }