Beispiel #1
0
 void ISendChatService.SendMessage(string msg, string sender, string receiver)
 {
     if (names.ContainsKey(receiver))
     {
         callback = names[receiver];
         callback.ReceiveMessage(msg, sender);
     }
 }
Beispiel #2
0
 public void Start(string name)
 {
     try
     {
         if (!names.ContainsKey(name))
         {
             callback = OperationContext.Current.GetCallbackChannel<IReceiveChatService>();
             AddUser(name, callback);
             SendNamesToAll();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
 public void Close()
 {
     callback = null;
     names.Clear();
 }
Beispiel #4
0
 private void AddUser(string name, IReceiveChatService callback)
 {
     names.Add(name, callback);
     if (ChatListOfNames != null)
     {
         ChatListOfNames(names.Keys.ToList(), this);
     }
 }