Пример #1
0
        public static void Uninstall()
        {
            if (!IsServiceInstalled())
            {
                if (unattended)
                {
                    return;
                }

                Console.WriteLine("Service Already Uninstalled");
                Console.WriteLine("Press <enter> to continue...");
                Console.ReadLine();
                ShowMenu();
                return;
            }

            StopService();

            SelfInstaller.UninstallMe();

            if (unattended)
            {
                return;
            }

            Console.WriteLine("Press <enter> to continue...");
            Console.ReadLine();
            ShowMenu();
        }
Пример #2
0
        public static void Install()
        {
            if (IsServiceInstalled())
            {
                if (unattended)
                {
                    Console.WriteLine("Service Already Installed... Uninstalling...");
                    SelfInstaller.UninstallMe();
                }

                else
                {
                    Console.WriteLine("Service Already Installed");
                    Console.WriteLine("Press <enter> to continue...");
                    Console.ReadLine();
                    ShowMenu();

                    return;
                }
            }

            Console.WriteLine("Installing Windows Service");
            SelfInstaller.InstallMe();


            // don't display the form to
            if (!unattended && Environment.UserInteractive)
            {
                Configure();
            }


            Console.WriteLine("Starting Windows Service");

            StartService();

            Console.WriteLine("Service Started");

            if (unattended)
            {
                return;
            }

            Console.WriteLine("Press <enter> to continue...");
            Console.ReadLine();
            ShowMenu();
        }