예제 #1
0
 public void SendMessage(Message m)
 {
     lock (_syncObj)
     {
         foreach (var callback in _clientsDict.Values)
         {
             callback.Receive(m);
         }
     }
     MainWindow.CurrentInstance.UpdateChatWindow(m.Content, m.Sender);
 }
예제 #2
0
        public void ServerSendMessage(string message, string userName)
        {
            var m = new Message
            {
                Sender  = "Server",
                Time    = DateTime.Now,
                Content = message
            };

            MainWindow.CurrentInstance.UpdateChatWindow(message, userName);
            lock (_syncObj)
            {
                foreach (var callback in _clientsDict.Values)
                {
                    callback.Receive(m);
                }
            }
        }