private void cmdTalk_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(txtTalk.Text)) { Protocol.Talk talk = new Protocol.Talk(); talk.From = txtEMail.Text; talk.Content = txtTalk.Text; mClient.Send(talk); txtTalk.Text = ""; txtTalk.Focus(); } }
public void Talk(Protocol.Talk e) { Paragraph p = new Paragraph(); p.Margin = new Thickness(0, 10, 0, 0); Image img = new Image(); BitmapImage logo = new BitmapImage(new Uri("pack://application:,,/siqi.testgui;component/Images/1423930703_chat.png")); img.Height = 16; img.Width = 16; img.Source = logo; p.Inlines.Add(img); Run run = new Run(); run.Text = e.From; if (e.From == txtEMail.Text) { run.Foreground = Brushes.Blue; } else { run.Foreground = Brushes.Green; } p.Inlines.Add(run); run = new Run(); run.Text = "(" + DateTime.Now.ToString() + ")"; p.Inlines.Add(run); txtTalkHistory.Document.Blocks.Add(p); p = new Paragraph(); p.Margin = new Thickness(0, 0, 0, 0); p.Padding = new Thickness(10, 0, 0, 0); run = new Run(); run.Text = e.Content; run.Foreground = Brushes.LightCoral; p.Inlines.Add(run); txtTalkHistory.Document.Blocks.Add(p); txtTalkHistory.ScrollToEnd(); }
public void Talk(EC.ISession session, Protocol.Talk e) { mDispatchFactory.Route(CreateToken(e, session)); }