Esempio n. 1
0
        /// <summary>
        /// The main entry point for the application
        /// <para>Основная точка входа для приложения</para>
        /// </summary>
        static void Main(string[] args)
        {
            // запуск агента
            Console.WriteLine("Starting Agent...");
            AgentManager agentManager = new AgentManager();

            if (agentManager.StartAgent())
            {
                Console.WriteLine("Agent is started successfully");
            }
            else
            {
                Console.WriteLine("Agent is started with errors");
            }

            Console.WriteLine("Press 'x' or create 'agentstop' file to stop Agent");

            // остановка службы при нажатии 'x' или обнаружении файла остановки
            FileListener stopFileListener = new FileListener(AppData.GetInstance().AppDirs.ConfigDir + "serverstop");

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound))
            {
                Thread.Sleep(ScadaUtils.ThreadDelay);
            }

            agentManager.StopAgent();
            stopFileListener.DeleteFile();
            stopFileListener.Abort();
            Console.WriteLine("Agent is stopped");
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            // service start
            Console.WriteLine("Starting SCADA-Server...");
            var manager = new Manager();

            manager.StartService();

            Console.WriteLine("SCADA-Server is started");
            Console.WriteLine("Press 'x' or create 'serverstop' file to stop SCADA-Server");

            // stopping the service when you press 'x' or find the file stop
            FileListener stopFileListener =
                new FileListener("Cmd" + Path.DirectorySeparatorChar + "serverstop");

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X ||
                     stopFileListener.FileFound))
            {
                Thread.Sleep(ScadaUtils.ThreadDelay);
            }
            manager.StopService();
            stopFileListener.DeleteFile();
            stopFileListener.Abort();
            Console.WriteLine("SCADA-Server is stopped");
        }
Esempio n. 3
0
        /// <summary>
        /// The main entry point for the application
        /// <para>The main entry point for the application</para>
        /// </summary>
        static void Main(string[] args)
        {
            // agent start
            Console.WriteLine("Starting Agent...");
            var agentManager = new AgentManager();

            if (agentManager.StartAgent())
            {
                Console.WriteLine("Agent is started successfully");
            }
            else
            {
                Console.WriteLine("Agent is started with errors");
            }

            Console.WriteLine("Press 'x' or create 'agentstop' file to stop Agent");

            // stopping the service when you press 'x' or find the file stop
            FileListener stopFileListener = new FileListener(AppData.GetInstance().AppDirs.ConfigDir + "serverstop");

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound))
            {
                Thread.Sleep(ScadaUtils.ThreadDelay);
            }

            agentManager.StopAgent();
            stopFileListener.DeleteFile();
            stopFileListener.Abort();
            Console.WriteLine("Agent is stopped");
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            // запуск службы
            Console.WriteLine("Starting SCADA-Server...");
            Manager manager = new Manager();
            manager.StartService();

            Console.WriteLine("SCADA-Server is started");
            Console.WriteLine("Press 'x' or create 'serverstop' file to stop SCADA-Server");

            // остановка службы при нажатии 'x' или обнаружении файла остановки
            FileListener stopFileListener = new FileListener("Cmd" + Path.DirectorySeparatorChar + "serverstop");
            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound))
                Thread.Sleep(ScadaUtils.ThreadDelay);
            manager.StopService();
            stopFileListener.DeleteFile();
            stopFileListener.Abort();
            Console.WriteLine("SCADA-Server is stopped");
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            // запуск службы
            Console.WriteLine("Starting SCADA-Server...");
            Manager manager = new Manager();

            manager.StartService();

            Console.WriteLine("SCADA-Server is started");
            Console.WriteLine("Press 'x' or create 'serverstop' file to stop SCADA-Server");

            // остановка службы при нажатии 'x' или обнаружении файла остановки
            FileListener stopFileListener = new FileListener("Cmd" + Path.DirectorySeparatorChar + "serverstop");

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound))
            {
                Thread.Sleep(ScadaUtils.ThreadDelay);
            }
            manager.StopService();
            stopFileListener.DeleteFile();
            stopFileListener.Abort();
            Console.WriteLine("SCADA-Server is stopped");
        }