示例#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 DeaWindowsService()
                };

                System.ServiceProcess.ServiceBase.Run(servicesToRun);
            }
            else
            {
                using (DeaWindowsService deaService = new DeaWindowsService())
                {
                    deaService.Start();
                    Console.WriteLine(Strings.PressEnterToStopConsoleMessage);
                    Console.ReadLine();
                    deaService.Stop();
                }
            }
        }
示例#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 DeaWindowsService()
                };

                System.ServiceProcess.ServiceBase.Run(servicesToRun);
            }
            else
            {
                using (DeaWindowsService deaService = new DeaWindowsService())
                {
                    deaService.Start();
                    Console.WriteLine(Strings.PressEnterToStopConsoleMessage);
                    Console.ReadLine();
                    deaService.Stop();
                }
            }
        }