/// <summary>
        /// Главная точка входа для приложения.
        /// </summary>
        static void Main()
        {
#if DEBUG
            Elastic elastic  = new Elastic();
            Thread  myThread = new Thread(new ThreadStart(elastic.RunTheard));
            myThread.Start();
#else
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new ServiceOnecLogElastic()
            };
            ServiceBase.Run(ServicesToRun);
#endif
        }
Exemple #2
0
 public void OnTimer(object sender, ElapsedEventArgs args)
 {
     try
     {
         timer.Stop();
         // запускаем в отдельном потоке
         Elastic elastic  = new Elastic();
         Thread  myThread = new Thread(new ThreadStart(elastic.RunTheard));
         myThread.Start();
         myThread.Join();
         timer.Start();
     }
     catch (Exception e)
     {
         Log.AddRecord("RunService", e.Message);
     }
 }