Example #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        internal static void Main()
        {
            //// sets the DEA priority higher.
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            if (!Environment.UserInteractive)
            {
                System.ServiceProcess.ServiceBase[] servicesToRun;
                servicesToRun = new System.ServiceProcess.ServiceBase[]
                {
                    new BoshAgentWindowsService()
                };
                System.ServiceProcess.ServiceBase.Run(servicesToRun);
            }
            else
            {
                using (BoshAgentWindowsService boshAgentService = new BoshAgentWindowsService())
                {
                    boshAgentService.Start();
                    Console.WriteLine(Strings.PressEnterToStopConsoleMessage);
                    Console.ReadLine();
                    boshAgentService.Stop();
                }
            }
        }
Example #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        internal static void Main()
        {
            //// sets the DEA priority higher.
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            if (!Environment.UserInteractive)
            {
                System.ServiceProcess.ServiceBase[] servicesToRun;
                servicesToRun = new System.ServiceProcess.ServiceBase[]
                {
                    new BoshAgentWindowsService()
                };
                System.ServiceProcess.ServiceBase.Run(servicesToRun);
            }
            else
            {
                using (BoshAgentWindowsService boshAgentService = new BoshAgentWindowsService())
                {
                    boshAgentService.Start();
                    Console.WriteLine(Strings.PressEnterToStopConsoleMessage);
                    Console.ReadLine();
                    boshAgentService.Stop();
                }
            }
        }