Smuxi.Frontend.Gnome.ChatView.AddMessage C# (CSharp) Method

AddMessage() public method

public AddMessage ( MessageModel msg ) : void
msg Smuxi.Engine.MessageModel
return void
        public virtual void AddMessage(MessageModel msg)
        {
            switch (msg.MessageType) {
                case MessageType.ChatNameChanged:
                    ThreadPool.QueueUserWorkItem(delegate {
                        try {
                            // REMOTING CALL
                            var newname = ChatModel.Name;
                            Gtk.Application.Invoke(delegate {
                                Name = newname;
                            });
                        } catch (Exception ex) {
                            Frontend.ShowException(ex);
                        }
                    });
                    return;
            }
            _OutputMessageTextView.AddMessage(msg);
        }

Usage Example

Example #1
0
        private void _AddMessageToChat(ChatModel chatModel, MessageModel msg)
        {
            ChatView chatView = _ChatViewManager.GetChat(chatModel);

            if (chatView == null)
            {
#if LOG4NET
                _Logger.Fatal(
                    String.Format(
                        "_AddMessageToChat(): " +
                        "_ChatViewManager.GetChat(chatModel) " +
                        "chatModel.Name: {0} returned null!",
                        chatModel.Name
                        )
                    );
#endif
                return;
            }

#if LOG4NET && MSG_DEBUG
            DateTime start, stop;
            start = DateTime.UtcNow;
#endif
            chatView.AddMessage(msg);
#if LOG4NET && MSG_DEBUG
            stop = DateTime.UtcNow;
            _Logger.Debug(
                String.Format(
                    "_AddMessageToChat(): chatView.AddMessage() took: {0:0.00} ms",
                    (stop - start).TotalMilliseconds
                    )
                );
#endif
        }