Exemple #1
0
        private void CheckCacheWithJid()
        {
            var contact = Helper.SdkWrapper.GetContactFromContactJid(peer.Jid);

            if (contact != null)
            {
                peer.Id = contact.Id;
                UpdateDisplay();
                return;
            }

            if (TaskCheckCacheWithJid == null)
            {
                TaskCheckCacheWithJid = CancelableDelay.StartAfter(300, () => CheckCacheWithJid());
            }
            else
            {
                TaskCheckCacheWithJid.PostPone();
            }
        }
        private void CheckCacheWithJid()
        {
            if (peer.Type == Rainbow.Model.Conversation.ConversationType.User)
            {
                var contact = Helper.SdkWrapper.GetContactFromContactJid(peer.Jid);
                if (contact != null)
                {
                    peer.Id = contact.Id;
                    UpdateAvatarImageDisplay();
                    return;
                }
            }
            else if (peer.Type == Rainbow.Model.Conversation.ConversationType.Room)
            {
                var bubble = Helper.SdkWrapper.GetBubbleByJidFromCache(peer.Jid);
                if (bubble != null)
                {
                    peer.Id = bubble.Id;
                    UpdateAvatarImageDisplay();
                    return;
                }
            }
            else
            {
                return;
            }

            if (TaskCheckCacheWithJid == null)
            {
                TaskCheckCacheWithJid = CancelableDelay.StartAfter(300, () => CheckCacheWithJid());
            }
            else
            {
                TaskCheckCacheWithJid.PostPone();
            }
        }