void IMessageObserver.OnHypeMessageReceived(Message message, Instance instance) { Debug.WriteLine(String.Format("Hype Got a message from: {0}", instance.GetStringIdentifier())); IChatDelegate chatDelegate = GetChatDelegate(); Store store = Stores[instance.GetStringIdentifier()]; string text = System.Text.Encoding.UTF8.GetString(message.GetData().ToArray()); store.Add(text); // Notify the chat delegate, causing the the conversation to be updated if (chatDelegate != null) { chatDelegate.OnMessageReceived(message); } else { // Notify the contacts delegate so that an indicator of new contact is shown // at the front of the sender's contact. This is shown as a green circle. IContactDelegate contactDelegate = GetContactDelegate(); if (contactDelegate != null) { contactDelegate.NotifyNewMessage(GetContactIndex(instance.GetStringIdentifier())); } } }
public void SetChatDelegate(IChatDelegate chatDelegate) { this._chatDelegate = new WeakReference <IChatDelegate>(chatDelegate); }