Ejemplo n.º 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>        
        static void Main()
        {
            if (Environment.CommandLine.Contains("-service"))
            {
                if (ServiceCheck(true) == false)
                {
                    ServiceController controller = new ServiceController(applicationName);
                    controller.Start();
                    return;
                }

                ServiceBase[] services = new ServiceBase[] { new ServiceWrapper() };
                ServiceBase.Run(services);
            }
            else if (Environment.CommandLine.Contains("-removeservice"))
            {
                if (ServiceCheck(false))
                {
                    ServiceController controller = new ServiceController(applicationName);
                    if (controller.Status == ServiceControllerStatus.Running) controller.Stop();
                    ServiceInstaller.UnInstallService(applicationName);
                }
            }
            else
            {
                ConsoleApplication application = new ConsoleApplication(applicationPath, true);
            }
        }
Ejemplo n.º 2
0
 protected override void OnStart(string[] args)
 {
     string applicationPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
     application = new ConsoleApplication(applicationPath, false);
 }
Ejemplo n.º 3
0
        protected override void OnStart(string[] args)
        {
            string applicationPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            application = new ConsoleApplication(applicationPath, false);
        }