UIAutomation.WizardHelper.RemoveWizardStep C# (CSharp) Method

RemoveWizardStep() public static method

public static RemoveWizardStep ( RemoveUiaWizardStepCommand cmdlet ) : void
cmdlet RemoveUiaWizardStepCommand
return void
        public static void RemoveWizardStep(RemoveUiaWizardStepCommand cmdlet)
        {
            if (cmdlet.InputObject != null && null != cmdlet.InputObject) {
                
                WizardStep stepToRemove = null;
                
                foreach (WizardStep step in cmdlet.InputObject.Steps.Where(step => step.Name == cmdlet.Name))
                {
                    stepToRemove = step;
                }
                
                cmdlet.InputObject.Steps.Remove(stepToRemove);
                
                if (cmdlet.PassThru) {
                    cmdlet.WriteObject(cmdlet, cmdlet.InputObject);
                } else {
                    cmdlet.WriteObject(cmdlet, true);
                }
            } else {
                
                cmdlet.WriteError(
                    cmdlet,
                    "The wizard object you provided is not valid",
                    "WrongWizardObject",
                    ErrorCategory.InvalidArgument,
                    true);
            }
            // WizardStep step = new WizardStep(Name, Order);
            // if (SearchCriteria != null && SearchCriteria.Length > 0) {
        }
        

Usage Example

コード例 #1
0
        public override void Execute()
        {
            RemoveUiaWizardStepCommand cmdlet =
                (RemoveUiaWizardStepCommand)Cmdlet;

            WizardHelper.RemoveWizardStep(cmdlet);
        }