コード例 #1
0
        private async Task Run()
        {
            Console.WriteLine("Welcome to EvlDaemon.");
            Console.WriteLine($"Connecting to {Ip}:{Port}...");

            var manager    = new EventManager(Partitions, Zones);
            var dispatcher = new EventDispatcher();

            foreach (var notifier in Notifiers)
            {
                dispatcher.AddNotifier(notifier);
            }

            connection = new Connection(Ip, Port, Password, dispatcher, manager);
            bool connected = await connection.ConnectAsync();

            if (connected)
            {
                Console.WriteLine("Connected to EVL.");
            }
            else
            {
                Console.WriteLine("Error connecting to EVL!");
            }

            string command;

            while (connection.Connected)
            {
                command = Console.ReadLine().ToLower();
                if (command == "quit" || command == "q")
                {
                    Quit();
                }
            }
        }