Esempio n. 1
0
        private void SendMessage()
        {
            var tabItem = tbChat.SelectedItem as ChatTabItem;

            if (tabItem != null)
            {
                var selectedUser = (string)tabItem.Header;
                var message      = tbMessage.Text;
                ChatClient.SendMessage(tbMessage.Text, selectedUser);

                var page = FindTabPage(selectedUser) ?? AddTabPage(selectedUser);
                tbChat.SelectedItem = page;
                var time = DateTime.Now.ToString("HH:mm:ss");

                page.DialogBox.AppendText($"[{time}] {ChatClient.UserName}: {message}");
                page.DialogBox.AppendText(Environment.NewLine);
            }
            tbMessage.Clear();
        }
Esempio n. 2
0
 private void SendMessageButton_OnClick(object sender, RoutedEventArgs e)
 {
     client.SendMessage(TargetUsername.Text, MessageToSend.Text);
 }