Esempio n. 1
0
        public void EnterChatMode()
        {
            sessionEndFlag              = false;
            chain                       = ChainFactory.Create <string>();
            chatClient.MessageReceived += ChatClient_MessageReceived;
            Con.WriteLine(Resources.EnterChatMessage(chatClient.ChattingWith));
            var message = "";

            do
            {
                readCancellationSource = new CancellationTokenSource();
                message = consoleHelper.CancellableReadLine(readCancellationSource.Token);
                if (!string.IsNullOrEmpty(message))
                {
                    if (message.ToLower() == "show chain")
                    {
                        ShowChain();
                    }
                    else
                    {
                        SendMessage(message);
                    }
                }
            } while (message.ToLower() != "exit chat" && !sessionEndFlag);
            ExitChatMode();
        }
Esempio n. 2
0
        public void Run()
        {
            Console.WriteLine(Resources.AwaitingCommands);
            var command = "";

            do
            {
                Console.Write("\n> ");
                readCancellationSource = new CancellationTokenSource();
                command = consoleHelper.CancellableReadLine(readCancellationSource.Token);
                if (!string.IsNullOrEmpty(command))
                {
                    ProcessSingleCommand(command);
                }
            } while (command != "exit");
        }