Ejemplo n.º 1
0
        private void Show()
        {
            Console.Clear();

            foreach (var service in winServicesAll)
            {
                service.Refresh();

                var status = service.Status.ToString();
                if (WinService.GetServiceStart(service.ServiceName) == ServiceStartMode.Disabled)
                {
                    status = "DISABLED (" + status + ")";
                }

                Console.WriteLine(" {0} - {1}", status.PadRight(20), service.DisplayName.PadLeft(30));
                service.Close();
            }
            Console.WriteLine();
            Console.WriteLine("Elija Una Opcion: ");
            Console.WriteLine(" F5 - Refrescar");
            Console.WriteLine(" 0  - Salir");
            Console.WriteLine(" 1  - Detiene y Deshabilita Todos Los Servicios");
            Console.WriteLine(" 2  - Habilita e Inicia Todos Los Servicios");
            Console.WriteLine(" 3  - Desinstala e Instala Todos Los Servicios");
        }
Ejemplo n.º 2
0
        public void OnKey(ConsoleKeyInfo inKey)
        {
            switch (inKey.Key)
            {
            case ConsoleKey.D0:
                Application.StopApplication();
                break;

            case ConsoleKey.D1:
                WinService.StopAndDisable(winServicesAll);
                break;

            case ConsoleKey.D2:
                WinService.EnableAndStart(winServicesAll);
                break;

            case ConsoleKey.D3:
                WinService.InstallAllServices(AutomaticUninstall, Purge, AutomaticInstall, AutomaticUpdate, ServiceNamePrefix, winServicesToInstall, this);
                winServicesAll = WinService.GetWindowsServices(ServiceNamePrefix);
                Console.WriteLine("Ready");
                break;

            case ConsoleKey.F5:
                Show();
                break;
            }
        }
Ejemplo n.º 3
0
        public override bool LoadResources()
        {
            winServicesToInstall = Elements().OfType <WinService>();

            winServicesAll = WinService.GetWindowsServices(ServiceNamePrefix);
            Show();
            ConsoleInput = new ConsoleInput(this);
            return(true);
        }