예제 #1
0
        public void Initialize(Message rootMessage)
        {
            RootMessage = _messageFactory.MakeMessageViewModel(rootMessage);
            RootMessage.LoadSender();

            AllMessages.Add(RootMessage);

            SelfIsSender = _sessionService.LoggedInUser.Id == rootMessage.SenderId;
        }
        public void Message(MessageSeverity severity, int code, string message, params object[] args)
        {
            var    msg = new Message(severity, code, Region, message, args);
            string s   = msg.ToString();                // Ensure this does not throw an exception

            AllMessages.Add(msg);
            if (_logToConsole)
            {
                Console.WriteLine(s);
            }
        }
 public void GetMessages()
 {
     while (true)
     {
         if (ClientSocket.newMessage != null)
         {
             AllMessages.Add(ClientSocket.newMessage);
             ClientSocket.newMessage = null;
             Application.Current.Dispatcher.Invoke(new System.Action(() => UpdateView()));
         }
     }
 }
예제 #4
0
        public void Message(MessageSeverity severity, int code, string message, params object[] args)
        {
            var msg = new Message(severity, code, Region, message, args);

            foreach (var a in args)
            {
                try {
                    new BinaryFormatter().Serialize(new MemoryStream(), a);
                }
                catch (Exception) {
                    throw new Exception("Error serializing argument " + a);
                }
            }
            string s = msg.ToString();                  // Ensure this does not throw an exception

            AllMessages.Add(msg);
            if (_logToConsole)
            {
                Console.WriteLine(s);
            }
        }
예제 #5
0
 public void AddMessage(Message message)
 {
     AllMessages.Add(_messageFactory.MakeMessageViewModel(message));
 }
예제 #6
0
 public void Write(string message, Color color)
 {
     AllMessages.Add(new Message {
         Text = message, Color = color
     });
 }