public static void CreateWizard(string name, ScriptBlock[] sb) { UIAutomation.Commands.NewUIAWizardCommand cmdlet = new UIAutomation.Commands.NewUIAWizardCommand(); cmdlet.Name = name; cmdlet.StartAction = sb; UIANewWizardCommand command = new UIANewWizardCommand(cmdlet); command.Execute(); }
public static void CreateWizard(string name, ScriptBlock[] sb) { Console.WriteLine("CreateWizard 00001"); UIAutomation.Commands.NewUIAWizardCommand cmdlet = new UIAutomation.Commands.NewUIAWizardCommand(); cmdlet.Name = name; Console.WriteLine("CreateWizard 00002"); // the -StartAction parameter could not be $null cmdlet.StartAction = new ScriptBlock[]{ }; UIANewWizardCommand command = new UIANewWizardCommand(cmdlet); Console.WriteLine("CreateWizard 00003"); command.Execute(); Console.WriteLine("CreateWizard 00004"); }