Exemplo n.º 1
0
        public async Task Test1Async()
        {
            var opt = new CommandLineOptions();

            opt.StartScriptPath = "start.ps1";
            var ps = new PowershellExecuter(opt);
            await ps.RunStartScript();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="modulePath"></param>
        public PsExecViewModel(string modulePath, string moduleFolderName)
        {
            IsBusy = false;
            CancelScriptExecution = false; // Half-way implemented
            CanInteract           = true;
            VisibleStatusBar      = false;
            _modulePath           = modulePath + "\\" + moduleFolderName + "\\";
            directoryReader       = new DirectoryReader(_modulePath);
            scriptReader          = new ScriptReader();
            powershellExecuter    = new PowershellExecuter();

            UpdateScriptCategoriesList();
            SetInitialScriptCategory();

            RadioButtonChecked            = new PsGui.Converters.CommandHandler(GetSelectedScriptCategoryName, CanClickRadiobutton);
            ScriptDescriptionButtonPushed = new PsGui.Converters.CommandHandlerAsync(GetScriptDescriptionAsync, CanClickDescriptionButton);
            ExecuteButtonPushed           = new PsGui.Converters.CommandHandlerAsync(StartOrStopScriptExecution, CanExecuteScript);

            // Error log only contains information of the last
            // crash and is reset upon starting the application again.
            Models.PsGuiException.ClearErrorLog();
        }