Exemplo n.º 1
0
 public static void CreateWizard(NewUiaWizardCommand cmdlet)
 {
     if (!cmdlet.ValidateWizardName(cmdlet.Name)) {
         
         cmdlet.WriteVerbose(
             cmdlet,
             "The wizard name you selected is already in use");
         
         cmdlet.WriteError(
             cmdlet,
             "The wizard name you selected is already in use",
             "NameInUse",
             ErrorCategory.InvalidArgument,
             true);
     }
     
     cmdlet.WriteVerbose(cmdlet, "wizard name validated");
     var wzd = new Wizard(cmdlet.Name);
     cmdlet.WriteVerbose(cmdlet, "wizard object created");
     wzd.StartAction = cmdlet.StartAction;
     wzd.StopAction = cmdlet.StopAction;
     wzd.DefaultStepForwardAction = cmdlet.DefaultStepForwardAction;
     wzd.DefaultStepBackwardAction = cmdlet.DefaultStepBackwardAction;
     wzd.DefaultStepCancelAction = cmdlet.DefaultStepCancelAction;
     // 20130319
     //wzd.DefaultStepGetWindowAction = cmdlet.DefaultStepGetWindowAction;
     wzd.GetWindowAction = cmdlet.GetWindowAction;
     cmdlet.WriteVerbose(cmdlet, "the wizard is fulfilled with properties");
     
     cmdlet.WriteObject(cmdlet, wzd);
 }
Exemplo n.º 2
0
        public override void Execute()
        {
            NewUiaWizardCommand cmdlet =
                (NewUiaWizardCommand)Cmdlet;

            WizardHelper.CreateWizard(cmdlet);
        }
Exemplo n.º 3
0
        public static void CreateWizard(NewUiaWizardCommand cmdlet)
        {
            if (!cmdlet.ValidateWizardName(cmdlet.Name))
            {
                cmdlet.WriteVerbose(
                    cmdlet,
                    "The wizard name you selected is already in use");

                cmdlet.WriteError(
                    cmdlet,
                    "The wizard name you selected is already in use",
                    "NameInUse",
                    ErrorCategory.InvalidArgument,
                    true);
            }

            cmdlet.WriteVerbose(cmdlet, "wizard name validated");
            var wzd = new Wizard(cmdlet.Name);

            cmdlet.WriteVerbose(cmdlet, "wizard object created");
            wzd.StartAction = cmdlet.StartAction;
            wzd.StopAction  = cmdlet.StopAction;
            wzd.DefaultStepForwardAction  = cmdlet.DefaultStepForwardAction;
            wzd.DefaultStepBackwardAction = cmdlet.DefaultStepBackwardAction;
            wzd.DefaultStepCancelAction   = cmdlet.DefaultStepCancelAction;
            // 20130319
            //wzd.DefaultStepGetWindowAction = cmdlet.DefaultStepGetWindowAction;
            wzd.GetWindowAction = cmdlet.GetWindowAction;
            cmdlet.WriteVerbose(cmdlet, "the wizard is fulfilled with properties");

            cmdlet.WriteObject(cmdlet, wzd);
        }
Exemplo n.º 4
0
        public static void CreateWizard(string name, ScriptBlock[] sb)
        {
            Console.WriteLine("CreateWizard 00001");
            NewUiaWizardCommand cmdlet =
                new NewUiaWizardCommand {
                Name = name
            };

            Console.WriteLine("CreateWizard 00002");
            // the -StartAction parameter could not be $null
            cmdlet.StartAction = new ScriptBlock[] { };
            NewWizardCommand command =
                new NewWizardCommand(cmdlet);

            Console.WriteLine("CreateWizard 00003");
            command.Execute();
            Console.WriteLine("CreateWizard 00004");
        }