Пример #1
0
        /// <summary>
        /// Processes the pipeline.
        /// </summary>
        protected override void ProcessRecord()
        {
            StepWizardCommand command =
                new StepWizardCommand(this);
            command.Execute();
            
//            // getting the step the user ordered to run
//            if (InputObject != null && InputObject is Wizard) {
//                WizardStep stepToRun = null;
//                WriteVerbose(this, "searching for a step");
//                foreach (WizardStep step in InputObject.Steps) {
//                    WriteVerbose(this, "found step: " + step.Name);
//                    if (step.Name == Name) {
//                        WriteVerbose(this, "found the step we've been searching for");
//                        stepToRun = step;
//                        break;
//                    }
//                }
//                if (stepToRun == null) {
//                    ErrorRecord err = 
//                        new ErrorRecord(
//                            new Exception("Couldn't find the step"),
//                            "StepNotFound",
//                            ErrorCategory.InvalidArgument,
//                            stepToRun.Name);
//                    err.ErrorDetails = 
//                        new ErrorDetails(
//                            "Failed to find the step");
//                    WriteError(this, err, true);
//                }
//                
//                bool result = false;
//                do {
//                    WriteVerbose(this, "checking controls' properties");
//                    
//                    // if there is no SearchCriteria, for example, there's at least one @{}
//                    if (stepToRun.SearchCriteria.Length == 0 ||
//                        System.Text.RegularExpressions.Regex.IsMatch(
//                            stepToRun.SearchCriteria.ToString(),
//                           @"[\@][\{]\s+?[\}]")) {
//                        result = true;
//                    } else {
//                        result = 
//                            testControlByPropertiesFromHashtable(
//                                // 20130315
//                                null,
//                                stepToRun.SearchCriteria,
//                                this.Timeout);
//                    }
//                    if (result) {
//                        
//                        WriteVerbose(this, "there are no SearchCriteria");
//                        WriteVerbose(this, "thus, control state is confirmed");
//                        //WriteObject(this, true);
//                        //return;
//                    } else {
//                        WriteVerbose(this, "control state is not yet confirmed. Checking the timeout");
//                        SleepAndRunScriptBlocks(this);
//                        // wait until timeout expires or the state will be confirmed as valid
//                        System.DateTime nowDate = 
//                            System.DateTime.Now;
//                        if ((nowDate - startDate).TotalSeconds > this.Timeout / 1000) {
//                            //WriteObject(this, false);
//                            //result = true;
//                            //return;
//                            WriteVerbose(this, "the timeout has already expired");
//                            ErrorRecord err = 
//                                new ErrorRecord(
//                                    new Exception("Timeout expired"),
//                                    "TimeoutExpired",
//                                    ErrorCategory.OperationTimeout,
//                                    this.InputObject);
//                            err.ErrorDetails = 
//                                new ErrorDetails(
//                                    "Timeout expired");
//                            WriteError(this, err, true);
//                        }
//                    }
//                } while (!result);
//                
//                WriteVerbose(this, "running script blocks");
//                RunWizardStepScriptBlocks(this, stepToRun, Forward);
//
//                if (PassThru) {
//
//                    WriteObject(this, InputObject);
//                } else {
//
//                    WriteObject(this, true);
//                }
//            } else {
//
//                ErrorRecord err = 
//                    new ErrorRecord(
//                        new Exception("The wizard object you provided is not valid"),
//                        "WrongWizardObject",
//                        ErrorCategory.InvalidArgument,
//                        InputObject);
//                err.ErrorDetails = 
//                    new ErrorDetails(
//                        "The wizard object you provided is not valid");
//                WriteError(this, err, true);
//            }
        }
Пример #2
0
        /// <summary>
        /// Processes the pipeline.
        /// </summary>
        protected override void ProcessRecord()
        {
            StepWizardCommand command =
                new StepWizardCommand(this);

            command.Execute();

//            // getting the step the user ordered to run
//            if (InputObject != null && InputObject is Wizard) {
//                WizardStep stepToRun = null;
//                WriteVerbose(this, "searching for a step");
//                foreach (WizardStep step in InputObject.Steps) {
//                    WriteVerbose(this, "found step: " + step.Name);
//                    if (step.Name == Name) {
//                        WriteVerbose(this, "found the step we've been searching for");
//                        stepToRun = step;
//                        break;
//                    }
//                }
//                if (stepToRun == null) {
//                    ErrorRecord err =
//                        new ErrorRecord(
//                            new Exception("Couldn't find the step"),
//                            "StepNotFound",
//                            ErrorCategory.InvalidArgument,
//                            stepToRun.Name);
//                    err.ErrorDetails =
//                        new ErrorDetails(
//                            "Failed to find the step");
//                    WriteError(this, err, true);
//                }
//
//                bool result = false;
//                do {
//                    WriteVerbose(this, "checking controls' properties");
//
//                    // if there is no SearchCriteria, for example, there's at least one @{}
//                    if (stepToRun.SearchCriteria.Length == 0 ||
//                        System.Text.RegularExpressions.Regex.IsMatch(
//                            stepToRun.SearchCriteria.ToString(),
//                           @"[\@][\{]\s+?[\}]")) {
//                        result = true;
//                    } else {
//                        result =
//                            testControlByPropertiesFromHashtable(
//                                // 20130315
//                                null,
//                                stepToRun.SearchCriteria,
//                                this.Timeout);
//                    }
//                    if (result) {
//
//                        WriteVerbose(this, "there are no SearchCriteria");
//                        WriteVerbose(this, "thus, control state is confirmed");
//                        //WriteObject(this, true);
//                        //return;
//                    } else {
//                        WriteVerbose(this, "control state is not yet confirmed. Checking the timeout");
//                        SleepAndRunScriptBlocks(this);
//                        // wait until timeout expires or the state will be confirmed as valid
//                        System.DateTime nowDate =
//                            System.DateTime.Now;
//                        if ((nowDate - startDate).TotalSeconds > this.Timeout / 1000) {
//                            //WriteObject(this, false);
//                            //result = true;
//                            //return;
//                            WriteVerbose(this, "the timeout has already expired");
//                            ErrorRecord err =
//                                new ErrorRecord(
//                                    new Exception("Timeout expired"),
//                                    "TimeoutExpired",
//                                    ErrorCategory.OperationTimeout,
//                                    this.InputObject);
//                            err.ErrorDetails =
//                                new ErrorDetails(
//                                    "Timeout expired");
//                            WriteError(this, err, true);
//                        }
//                    }
//                } while (!result);
//
//                WriteVerbose(this, "running script blocks");
//                RunWizardStepScriptBlocks(this, stepToRun, Forward);
//
//                if (PassThru) {
//
//                    WriteObject(this, InputObject);
//                } else {
//
//                    WriteObject(this, true);
//                }
//            } else {
//
//                ErrorRecord err =
//                    new ErrorRecord(
//                        new Exception("The wizard object you provided is not valid"),
//                        "WrongWizardObject",
//                        ErrorCategory.InvalidArgument,
//                        InputObject);
//                err.ErrorDetails =
//                    new ErrorDetails(
//                        "The wizard object you provided is not valid");
//                WriteError(this, err, true);
//            }
        }