コード例 #1
0
        /// <summary>
        /// Loop through all tests(steps) and execute
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void runButton_Click(object sender, EventArgs e)
        {
//            StepPing.ShowPass();
            ucDiagnosticStep.StepResult myResult = ucDiagnosticStep.StepResult.stepFailed;


            /// <summary>
            /// loop through diagnostic steps
            /// </summary>
            foreach (diagnosticStepInfo aStep in mySteps)
            {
                aStep.objMyStep.ShowNotRun();
            }

            foreach (diagnosticStepInfo aStep in mySteps)
            {
                if (aStep.objMyStep.CheckRunStep == true)
                {
                    myResult = aStep.objMyStep.RunTest();
                    aStep.objMyStep.stepResult = myResult;
                    if (myResult == ucDiagnosticStep.StepResult.stepPassed)
                    {
                        aStep.objMyStep.ShowPass();
                    }
                    else
                    {
                        if (myResult == ucDiagnosticStep.StepResult.stepFailed)
                        {
                            aStep.objMyStep.ShowFail();
                            break;
                        }
                        else
                        {
                            if (myResult == ucDiagnosticStep.StepResult.stepUserCancelled)
                            {
                                aStep.objMyStep.ShowNotRun();
                            }
                        }
                    }
                }
            }
            if (myResult != ucDiagnosticStep.StepResult.stepFailed)
            {
                ExplanationForm myform = new ExplanationForm();
                myform.strLabel1 = "No Problems Found through this diagnostic tool!";
                myform.strLabel2 = "Contact IT or AME for further investigation if problem still persists.";
                myform.ShowDialog();
            }
        }
コード例 #2
0
        /// <summary>
        /// Начать консультацию
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartConsultationToolStripMenuItemClick(object sender, EventArgs e)
        {
            //сразу же инициализируем форму объяснения
            var formExplain = new ExplanationForm();
            //вызываем форму консультации
            var formConsult = new FormConsult
            {
                Es = new InferentialMechanism.Db(_esCopy.Connection),
                AddToExplanation = formExplain.AddRuleToTreeView
            };

            formConsult.ShowDialog();
            //показываем форму объяснения
            formExplain.Res    = formConsult.Goal + " = " + formConsult.Result;
            formExplain.Memory = formConsult.WorkMemory;
            formExplain.ShowDialog();
            //Обновляем listView
            listViewConsultations.Items.Add(
                new ListViewItem(new [] { DateTime.Now.Date.ToShortDateString(), formConsult.Goal, formConsult.Result }));
        }