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