Esempio n. 1
0
 public SysTrayIcon(SysTrayOption[] optionsList)
 {
     OptionsList     = optionsList;
     serviceNames    = OptionsList.GetServiceNames();
     serviceStatuses = ServiceTools.GetWindowsServicesStatuses(serviceNames);
     trayMenu        = initContextMenu();
     trayIcon        = initNotifyIcon();
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 private void TryServiceToggle()
 {
     try
     {
         ServiceTools.ToggleService(this.ServiceName);
     }
     catch (Exception ex)
     {
         this.Error = true;
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 4
0
 public static bool IsRunning(string name)
 {
     return(ServiceTools.GetWindowsServiceStatus(name).Equals("Running"));
 }