private void Initialize() { if (stat != null) { stat.SetStatus("Looking for modules, please wait..."); } CheckPendingModules(); BuildModuleFilter(); if (stat != null) { stat.SetStatus("Checking for updates, please wait..."); } // Set up GitHub Timer for Checking for Updates ghChecker = new System.Timers.Timer(); ghChecker.Interval = 3600000; //One Hour ghChecker.Elapsed += ghChecker_Elapsed; ghChecker.Enabled = true; CheckLastModified(); cmbLibraryTypes.SelectedIndex = 0; if (stat != null) { stat.SetStatus("Initializing PowerShell, please wait..."); } psf = new PShell.pshell(this); psf.ImportPSModules(enabledmods); psf.ParentForm = this; scnr.ParentForm = this; if (psf.LoadErrors != "") { loaderrors += psf.LoadErrors; } txtPShellOutput.Text = StringValue.psf; mincurpos = txtPShellOutput.Text.Length; txtPShellOutput.SelectionStart = mincurpos; if (stat != null) { stat.SetStatus("Loading script library, please wait..."); } GetLibrary(); if (stat != null) { stat.SetStatus("Getting commands, please wait..."); } GetCommand(); if (stat != null) { stat.SetStatus("Loading schedule library, please wait..."); } LoadSchedule(); InitSyslog(); }
private void RunScript() { if (lvwScripts.SelectedItems.Count > 0) { ListViewItem lvw = lvwScripts.SelectedItems[0]; //This needs to be a separate runspace. PShell.pshell ps = new PShell.pshell(this); ps.ParentForm = this; if (lvw.Group.Header != null && lvw.Group.Header != "General") { ps.Run(Path.Combine(lvw.Group.Header, lvw.Text)); } else { ps.Run(lvw.Text); } ps = null; } }
private void RunScript(Utility.ScheduleItem sched) { if (sched != null) { PShell.pshell ps = new PShell.pshell(this); ps.ParentForm = this; ps.Run(sched); } }
private void Initialize() { CheckSettings(); psf = new PShell.pshell(); if (psf.LoadErrors != "") { loaderrors += psf.LoadErrors; } txtPShellOutput.Text = StringValue.psf; mincurpos = txtPShellOutput.Text.Length; txtPShellOutput.SelectionStart = mincurpos; scnr.ParentForm = this; cmbLibraryTypes.SelectedIndex = 1; psf.ParentForm = this; GetLibrary(); GetCommand(); LoadSchedule(); }