GetActiveStep() публичный Метод

public GetActiveStep ( ) : WizardStep
Результат WizardStep
Пример #1
0
        protected internal void RunWizardInAutomaticMode(WizardRunCmdletBase cmdlet, Wizard wizard)
        {
            cmdlet.StartDate =
                DateTime.Now;
            
            string previousStepName = string.Empty;
            
            // 20140314
            // while (cmdlet.RunWizardGetWindowScriptBlocks(wizard, null)) {
            while (cmdlet.RunWizardGetWindowScriptBlocks(wizard, null) && !wizard.StopImmediately) {
                
                if (null != CurrentData.CurrentWindow) {
                    
                    cmdlet.WriteInfo(cmdlet, "Getting the active step");
                    
                    // selector of steps' unique controls
                    WizardStep currentStep = null;
                    try {
                        currentStep = wizard.GetActiveStep();
                    } catch (Exception) {
                        continue;
                    }
                    
                    // 20130506
                    //WizardCollection.CurrentWizard = wizard;

                    if (null != currentStep) {
                        
                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step name = '" +
                            currentStep.Name +
                            "'");
                        
                        cmdlet.WriteInfo(cmdlet, "the active step is '" + currentStep.Name + "'");
                        
                        // 20130327
                        if (previousStepName == currentStep.Name) {
                            
                            InterruptOnTimeoutExpiration(cmdlet, wizard);
                            
                            // 20130508
                            cmdlet.WriteInfo(cmdlet, "the same step, sleeping...");
                            Thread.Sleep(Preferences.OnSelectWizardStepDelay);
                            continue;
                        }
                        previousStepName = currentStep.Name;

                        object[] currentParameters = GetStepParameters(wizard, currentStep);

                        cmdlet.WriteInfo(cmdlet, "running step '" + currentStep.Name + "'");
                        cmdlet.WriteInfo(cmdlet, "parameters: " + ConvertObjectArrayToString(currentParameters));
                        RunCurrentStepParameters(cmdlet, wizard, currentStep, currentParameters);

                        // 20130325
                        if (wizard.StopImmediately) {

                            cmdlet.WriteInfo(cmdlet, "stopping the wizard");
                            break;
                        }
                        
                        #region commented
                        // 20130319 - need moving to an appropriate place
                        //cmdlet.RunWizardStepCancelScriptBlocks(
                        //    cmdlet,
                        //    currentStep,
                        //    currentStep.StepCancelActionParameters);
                        #endregion commented
                        
                        cmdlet.StartDate =
                            DateTime.Now;
                        
                    } else {
                        
                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step is still null");
                        
                        // 20130508
                        // temporary
                        // profiling
                        cmdlet.WriteInfo(cmdlet, "the current step is still null");

                        // 20130712
                        //InterruptOnTimeoutExpiration(cmdlet, wizard);
                        bool interrupt1 = InterruptOnTimeoutExpiration(cmdlet, wizard);
                        // 20130402
                        // 20130712
                        //break;
                        if (interrupt1) {
                            break;
                        }
                        
                    }
                } else {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "window is still null");
                    
                    // 20130508
                    // temporary
                    // profiling
                    cmdlet.WriteInfo(cmdlet, "window is still null");
                    
                    // 20130402
                    // 20130712
                    //InterruptOnTimeoutExpiration(cmdlet, wizard);
                    bool interrupt2 = InterruptOnTimeoutExpiration(cmdlet, wizard);
                    if (interrupt2) {
                        break;
                    }
                    // 20130712
                    //break;
                }
            }
        }
Пример #2
0
        protected internal void RunWizardInAutomaticMode(WizardRunCmdletBase cmdlet, Wizard wizard)
        {
            cmdlet.StartDate =
                System.DateTime.Now;

            string previousStepName = string.Empty;

            while (cmdlet.RunWizardGetWindowScriptBlocks(cmdlet, wizard, null)) {

                if (null != (CurrentData.CurrentWindow as AutomationElement)) {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "the window: name = '" +
                        CurrentData.CurrentWindow.Current.Name +
                        "', automationId = '" +
                        CurrentData.CurrentWindow.Current.AutomationId +
                        "', class = '" +
                        CurrentData.CurrentWindow.Current.ClassName +
                        "', processId = " +
                        CurrentData.CurrentWindow.Current.ProcessId.ToString() +
                        ".");

                    cmdlet.WriteInfo(cmdlet, "Getting the active step");

                    // selector of steps' unique controls
                    WizardStep currentStep =
                        wizard.GetActiveStep();

                    // 20130506
                    //WizardCollection.CurrentWizard = wizard;

                    if (null != currentStep) {

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step name = '" +
                            currentStep.Name +
                            "'");

                        cmdlet.WriteInfo(cmdlet, "the active step is '" + currentStep.Name + "'");

                        // 20130327
                        if (previousStepName == currentStep.Name) {

                            InterruptOnTimeoutExpiration(cmdlet, wizard);

                            // 20130508
                            cmdlet.WriteInfo(cmdlet, "the same step, sleeping...");
                            System.Threading.Thread.Sleep(Preferences.OnSelectWizardStepDelay);
                            continue;
                        }
                        previousStepName = currentStep.Name;

                        object[] currentParameters = GetStepParameters(wizard, currentStep);

                        cmdlet.WriteInfo(cmdlet, "running step '" + currentStep.Name + "'");
                        cmdlet.WriteInfo(cmdlet, "parameters: " + this.ConvertObjectArrayToString(currentParameters));
                        RunCurrentStepParameters(cmdlet, wizard, currentStep, currentParameters);

                        // 20130325
                        if (wizard.StopImmediately) {

                            cmdlet.WriteInfo(cmdlet, "stopping the wizard");
                            break;
                        }

                        #region commented
                        // 20130319 - need moving to an appropriate place
                        //cmdlet.RunWizardStepCancelScriptBlocks(
                        //    cmdlet,
                        //    currentStep,
                        //    currentStep.StepCancelActionParameters);
                        #endregion commented

                        cmdlet.StartDate =
                            System.DateTime.Now;

                    } else {

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step is still null");

                        // 20130508
                        // temporary
                        // profiling
                        cmdlet.WriteInfo(cmdlet, "the current step is still null");

                        InterruptOnTimeoutExpiration(cmdlet, wizard);
                        // 20130402
                        break;

                    }
                } else {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "window is still null");

                    // 20130508
                    // temporary
                    // profiling
                    cmdlet.WriteInfo(cmdlet, "window is still null");

                    // 20130402
                    InterruptOnTimeoutExpiration(cmdlet, wizard);
                    break;
                }
            }
        }
Пример #3
0
        protected internal void RunWizardInAutomaticMode(WizardRunCmdletBase cmdlet, Wizard wizard)
        {
            // 20130320
            //CurrentData.CurrentWindow = AutomationElement.RootElement;

            cmdlet.StartDate =
                System.DateTime.Now;

            // 20130327
            string previousStepName = string.Empty;

            // 20130320
            //while ((null != CurrentData.CurrentWindow)) {
            while (cmdlet.RunWizardGetWindowScriptBlocks(cmdlet, wizard, null)) {

                #region commented
                // 20130325
            //			    if (wizard.StopImmediately) {
            //			        break;
            //			    }

                // 20130320
                //CurrentData.CurrentWindow = null;
                // 20130318
                //cmdlet.RunWizardGetWindowScriptBlocks(cmdlet, wizard);
                // 20130320
                //cmdlet.RunWizardGetWindowScriptBlocks(cmdlet, wizard, null);
                #endregion commented

                if (null != (CurrentData.CurrentWindow as AutomationElement)) {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "the window: name = '" +
                        CurrentData.CurrentWindow.Current.Name +
                        "', automationId = '" +
                        CurrentData.CurrentWindow.Current.AutomationId +
                        "', class = '" +
                        CurrentData.CurrentWindow.Current.ClassName +
                        "', processId = " +
                        CurrentData.CurrentWindow.Current.ProcessId.ToString() +
                        ".");

                    // selector of steps' unique controls
                    WizardStep currentStep =
                        wizard.GetActiveStep();

                    if (null != currentStep) {

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step name = '" +
                            currentStep.Name +
                            "'");

                        // 20130327
                        if (previousStepName == currentStep.Name) {

                            InterruptOnTimeoutExpiration(cmdlet, wizard);

                            System.Threading.Thread.Sleep(Preferences.OnSelectWizardStepDelay);
                            continue;
                        }
                        previousStepName = currentStep.Name;

                        object[] currentParameters = GetStepParameters(wizard, currentStep);

                        RunCurrentStepParameters(cmdlet, wizard, currentStep, currentParameters);

                        // 20130325
                        if (wizard.StopImmediately) {

                            break;
                        }

                        #region commented
                        // 20130319 - need moving to an appropriate place
                        //cmdlet.RunWizardStepCancelScriptBlocks(
                        //    cmdlet,
                        //    currentStep,
                        //    currentStep.StepCancelActionParameters);
                        #endregion commented

                        cmdlet.StartDate =
                            System.DateTime.Now;

                    } else {

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step is still null");

                        InterruptOnTimeoutExpiration(cmdlet, wizard);
                        // 20130402
                        break;

                    }
                } else {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "window is still null");

                    // 20130402
                    InterruptOnTimeoutExpiration(cmdlet, wizard);
                    break;
                }
            }
        }
Пример #4
0
        protected internal void RunWizardInAutomaticMode(WizardRunCmdletBase cmdlet, Wizard wizard)
        {
            cmdlet.StartDate =
                DateTime.Now;

            string previousStepName = string.Empty;

            // 20140314
            // while (cmdlet.RunWizardGetWindowScriptBlocks(wizard, null)) {
            while (cmdlet.RunWizardGetWindowScriptBlocks(wizard, null) && !wizard.StopImmediately)
            {
                if (null != CurrentData.CurrentWindow)
                {
                    cmdlet.WriteInfo(cmdlet, "Getting the active step");

                    // selector of steps' unique controls
                    WizardStep currentStep = null;
                    try {
                        currentStep = wizard.GetActiveStep();
                    } catch (Exception) {
                        continue;
                    }

                    // 20130506
                    //WizardCollection.CurrentWizard = wizard;

                    if (null != currentStep)
                    {
                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step name = '" +
                            currentStep.Name +
                            "'");

                        cmdlet.WriteInfo(cmdlet, "the active step is '" + currentStep.Name + "'");

                        // 20130327
                        if (previousStepName == currentStep.Name)
                        {
                            InterruptOnTimeoutExpiration(cmdlet, wizard);

                            // 20130508
                            cmdlet.WriteInfo(cmdlet, "the same step, sleeping...");
                            Thread.Sleep(Preferences.OnSelectWizardStepDelay);
                            continue;
                        }
                        previousStepName = currentStep.Name;

                        object[] currentParameters = GetStepParameters(wizard, currentStep);

                        cmdlet.WriteInfo(cmdlet, "running step '" + currentStep.Name + "'");
                        cmdlet.WriteInfo(cmdlet, "parameters: " + ConvertObjectArrayToString(currentParameters));
                        RunCurrentStepParameters(cmdlet, wizard, currentStep, currentParameters);

                        // 20130325
                        if (wizard.StopImmediately)
                        {
                            cmdlet.WriteInfo(cmdlet, "stopping the wizard");
                            break;
                        }

                        #region commented
                        // 20130319 - need moving to an appropriate place
                        //cmdlet.RunWizardStepCancelScriptBlocks(
                        //    cmdlet,
                        //    currentStep,
                        //    currentStep.StepCancelActionParameters);
                        #endregion commented

                        cmdlet.StartDate =
                            DateTime.Now;
                    }
                    else
                    {
                        cmdlet.WriteVerbose(
                            cmdlet,
                            "current step is still null");

                        // 20130508
                        // temporary
                        // profiling
                        cmdlet.WriteInfo(cmdlet, "the current step is still null");

                        // 20130712
                        //InterruptOnTimeoutExpiration(cmdlet, wizard);
                        bool interrupt1 = InterruptOnTimeoutExpiration(cmdlet, wizard);
                        // 20130402
                        // 20130712
                        //break;
                        if (interrupt1)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    cmdlet.WriteVerbose(
                        cmdlet,
                        "window is still null");

                    // 20130508
                    // temporary
                    // profiling
                    cmdlet.WriteInfo(cmdlet, "window is still null");

                    // 20130402
                    // 20130712
                    //InterruptOnTimeoutExpiration(cmdlet, wizard);
                    bool interrupt2 = InterruptOnTimeoutExpiration(cmdlet, wizard);
                    if (interrupt2)
                    {
                        break;
                    }
                    // 20130712
                    //break;
                }
            }
        }