예제 #1
0
        public MessageChannel AwaitNextConnection()
        {
            TcpClient tcpClient = _server.AcceptTcpClient();

            var xport = new TcpMessageTransport(tcpClient);
            var format = new DipMessageFormat();
            return new MessageChannel(xport, format);
        }
예제 #2
0
파일: Client.cs 프로젝트: vogon/Demotic
        public void Start()
        {
            TcpClient client = new TcpClient(_hostname, _port);

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

            _channel = new MessageChannel(_xport, _format);
            _channel.MessageReceived += OnMessageReceived;
        }
예제 #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;
            }
        }