예제 #1
0
        public static void Main()
        {
            Console.WriteLine("Start");

            var  ctx  = new CancellationTokenSource();
            Task task = new Task(() =>
            {
                var commandProcessor = new CommandProcessor();

                var messageReceiver = new MessageReceiver(new GameInstance());
                messageReceiver.RegisterHandler(MessageVerb.CreateRoom, new CreateRoomMessageHandler(commandProcessor, new MessageSender()));
                commandProcessor.BeginProcessing();


                while (true)
                {
                    Thread.Sleep(1000);
                    SendMessage(messageReceiver);
                }
            }, ctx.Token);

            task.Start();

            Console.ReadLine();
            ctx.Cancel();
        }