/// <summary> /// On check or uncheck each checkbox update list of user services. /// </summary> protected virtual void OnServiceCheckToggled(object sender, System.EventArgs e) { CheckButton cbutton = sender as CheckButton; if (cbutton.Active) { SystemServices.AddItemToUserlist(cbutton.Label); } else { SystemServices.RemoveItemFromUserklist(cbutton.Label); } }
public string Perform(ServiceActionType action) { Process process = new Process(); process.StartInfo.FileName = SystemServices.SudoCommand; process.StartInfo.Arguments = SystemServices.GetArgsForService(Script, action); process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.Start(); string stdout = process.StandardOutput.ReadToEnd(); string stderr = process.StandardError.ReadToEnd(); return(stdout + "\n" + stderr); }
public SystemServicesConfig() { this.Build(); // create checkbox for each service found in /etc/*/init.d/* IDictionary <string, bool> services = SystemServices.GetServicesNamesWithStatus(); foreach (KeyValuePair <string, bool> service in services) { CheckButton cbutton = new CheckButton(service.Key); // and set active cbutton.Active = service.Value; this.boxServicesList.Add(cbutton); cbutton.Clicked += OnServiceCheckToggled; } this.eCommand.Text = SystemServices.SudoCommand; }
public override void UpdateItems() { items = SystemServices.LoadServices(); }