Exemplo n.º 1
0
        public MessageChannel AwaitNextConnection()
        {
            TcpClient tcpClient = _server.AcceptTcpClient();

            var xport = new TcpMessageTransport(tcpClient);
            var format = new DipMessageFormat();
            return new MessageChannel(xport, format);
        }
Exemplo n.º 2
0
        public void Start()
        {
            TcpClient client = new TcpClient(_hostname, _port);

            _xport = new TcpMessageTransport(client);
            _format = new DipMessageFormat();

            _channel = new MessageChannel(_xport, _format);
            _channel.MessageReceived += OnMessageReceived;
        }
Exemplo n.º 3
0
        private void PromptTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            DipMessageFormat format = new DipMessageFormat();

            if (e.Text == "\r")
            {
                int consumed = 0;
                Message msg = format.Decode(Encoding.UTF8.GetBytes(PromptTextBox.Text), out consumed);

                ConversationViewModel convoVm = _consoleVm.StartConversation(msg);
                ConversationView convoView = new ConversationView(convoVm);

                ScrollbackTextBox.Document.Blocks.Add(convoView.View);
                _conversations.Add(convoView);

                ScrollbackTextBox.ScrollToEnd();

                PromptTextBox.Clear();

                e.Handled = true;
            }
        }