Beispiel #1
0
        /// <summary>
        /// Formats the ChatMessage and adds it as a new paragraph to the ChatTextBox.
        /// </summary>
        /// <param name="message"></param>
        public void AddMessage(ChatMessage message)
        {
            Paragraph p = new Paragraph();
            p.Margin = new Thickness (0, 0, 0, 3);

            var date = new Run (String.Format ("({0}) ", message.Timestamp.ToLongTimeString ()));
            date.FontSize = _fontsize - 2;
            date.FontWeight = FontWeights.Bold;
            date.Foreground = Brushes.DarkGray;

            var username = new Run (message.SenderNickname + ": ");
            username.FontSize = _fontsize;
            username.FontWeight = FontWeights.Bold;
            username.Foreground = Brushes.DarkOrchid;

            var text = new Run (message.Content);
            text.FontSize = _fontsize;

            p.Inlines.Add (date);
            p.Inlines.Add (username);
            p.Inlines.Add (text);

            this.Document.Blocks.Add (p);
            this.ScrollToEnd ();
        }
 public void SendChatMessage(string content)
 {
     ChatMessage message;
     message = new ChatMessage (Status.Users.Current.Name, content);
     Status.Users.ForEach (user => user.Callback.ReceiveChatMessage (message));
 }