Example #1
0
        internal void SendMessage(ChatWindow chatWindow, TextMessage msg)
        {
            var client = chats.FirstOrDefault(x => x.Value == chatWindow).Key;
            var packet = TextProtocol.CreateTextPacket(msg.Text, MessageProtocol.MessageType.PRIVATE, null);

            packet.headers.Add("Username", ownUsername);
            client.SendOrdered(FyzrParser.ToData(packet));
        }
Example #2
0
        private void btnServerSend_Click(object sender, RoutedEventArgs e)
        {
            if (txtServerMessage.Text.Trim().Length == 0)
            {
                MessageBox.Show("Enter some text first");
                return;
            }
            string message = txtServerMessage.Text;


            Client client = fromClients[0];

            client.SendOrdered(
                FyzrParser.ToData(
                    TextProtocol.CreateTextPacket(message, MessageProtocol.MessageType.PRIVATE, null)
                    ));
            Dispatcher.Invoke(() => { listServerMessages.Items.Add("Alice: " + message); });
        }