Example #1
0
        public void Run()
        {
            const string ServiceName = "EndeavourEmisWebPollerConsole";

            _poller = new Poller(ServiceName, Stop);
            _poller.Start();

            Log.WriteToConsoleAndLog(string.Empty);
            Log.WriteToConsoleAndLog(ServiceName + " service running.  Press any key to stop service.");

            while (true)
            {
                if (_requestStop)
                {
                    break;
                }

                if (Console.KeyAvailable)
                {
                    while (Console.KeyAvailable)
                    {
                        Console.Read();
                    }

                    Log.WriteToConsoleAndLog("Key pressed.  Stopping service...");
                    break;
                }

                Thread.Sleep(200);
            }

            _poller.Stop();

            Log.WriteToConsoleAndLog("Service stopped.");
        }
Example #2
0
        protected override void OnStart(string[] args)
        {
            _poller.Start();

            base.OnStart(args);
        }