예제 #1
0
        private static void Main(params string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            if (Environment.UserInteractive || (args.Any() && args[0].Equals("-console")))
            {
                var service = new StorageCleanerService();
                service.StartConsole();
            }
            else
            {
                ServiceBase.Run(new StorageCleanerService());
            }
        }
예제 #2
0
        private static void Main(params string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            if (Environment.UserInteractive || (args.Any() && args[0].Equals("-console")))
            {
                var service = new StorageCleanerService();
                service.StartConsole();
            }
            else
            {
                ServiceBase.Run(new StorageCleanerService());
            }
        }
예제 #3
0
        static void Main(params string[] args)
        {
            if (args.Length > 0)
            {
                if (args[0].Equals("/service"))
                {
                    if (ServiceSelfInstaller.Install())
                    {
                        MessageBox.Show("The service install successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("The service install error.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (args[0].Equals("/unservice"))
                {
                    if (ServiceSelfInstaller.Uninstall())
                    {
                        MessageBox.Show("The service uninstall successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("The service uninstall error.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (args[0].Equals("/console"))
                {
                    var service = new StorageCleanerService();
                    service.StartConsole();
                }

            }
            else
            {
                ServiceBase.Run(new StorageCleanerService());
            }
        }
예제 #4
0
 static void Main(params string[] args)
 {
     if (args.Length > 0)
     {
         if (args[0].Equals("/service"))
         {
             if (ServiceSelfInstaller.Install())
             {
                 MessageBox.Show("The service install successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("The service install error.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else if (args[0].Equals("/unservice"))
         {
             if (ServiceSelfInstaller.Uninstall())
             {
                 MessageBox.Show("The service uninstall successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("The service uninstall error.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else if (args[0].Equals("/console"))
         {
             var service = new StorageCleanerService();
             service.StartConsole();
         }
     }
     else
     {
         ServiceBase.Run(new StorageCleanerService());
     }
 }