public SysTrayIcon(SysTrayOption[] optionsList) { OptionsList = optionsList; serviceNames = OptionsList.GetServiceNames(); serviceStatuses = ServiceTools.GetWindowsServicesStatuses(serviceNames); trayMenu = initContextMenu(); trayIcon = initNotifyIcon(); }
public static Dictionary <string, string> GetWindowsServicesStatuses(string[] names) { Dictionary <string, string> statuses = new Dictionary <string, string> { }; foreach (string service in names) { statuses[service] = ServiceTools.GetWindowsServiceStatus(service); } return(statuses); }
private void TryServiceToggle() { try { ServiceTools.ToggleService(this.ServiceName); } catch (Exception ex) { this.Error = true; MessageBox.Show(ex.Message); } }
public static bool IsRunning(string name) { return(ServiceTools.GetWindowsServiceStatus(name).Equals("Running")); }