Exemplo n.º 1
0
 private void RbInstantMessaging_UserTypingChanged(object sender, Rainbow.Events.UserTypingEventArgs e)
 {
     OnUserTypingChanged(sender, e);
 }
Exemplo n.º 2
0
        private void RainbowInstantMessaging_UserTypingChanged(object sender, Rainbow.Events.UserTypingEventArgs e)
        {
            //e.ContactJid
            //e.ConversationId

            bool   concernCurrentSelection = false;
            string contactDisplayName      = "";

            // Check if event recevied concern the form selection or not
            if (selectionCorrect)
            {
                Conversation conversation = rainbowConversations.GetConversationByIdFromCache(e.ConversationId);
                if (contactSelected)
                {
                    if (conversation != null)
                    {
                        concernCurrentSelection = ((conversation.Type == Conversation.ConversationType.User) && (idSelected == conversation.PeerId));

                        Contact contact = rainbowContacts.GetContactFromContactId(idSelected);
                        contactDisplayName = GetContactDisplayName(contact);
                    }
                    else
                    {
                        AddStateLine($"ContactSelected - No conversation found ...");
                        return;
                    }
                }
                else
                {
                    concernCurrentSelection = (idSelected == e.ConversationId);
                    if (conversation != null)
                    {
                        if (conversation.Type == Conversation.ConversationType.User)
                        {
                            Contact contact = rainbowContacts.GetContactFromContactId(conversation.PeerId);
                            contactDisplayName = GetContactDisplayName(contact);
                        }
                        else
                        {
                            contactDisplayName = conversation.Name;
                            if (String.IsNullOrEmpty(contactDisplayName))
                            {
                                contactDisplayName = conversation.Id;
                            }
                        }
                    }
                    else
                    {
                        AddStateLine($"ConversationSelected - No conversation found ...");
                        return;
                    }
                }

                if (concernCurrentSelection)
                {
                    if (e.IsTyping)
                    {
                        AddStateLine($"[{contactDisplayName}] is typing in the CURRENT SELECTED conversation.");
                    }
                    else
                    {
                        AddStateLine($"[{contactDisplayName}] is no more typing in the CURRENT SELECTED conversation.");
                    }
                }
                else
                {
                    if (e.IsTyping)
                    {
                        AddStateLine($"[{contactDisplayName}] is typing in ANOTHER conversation.");
                    }
                    else
                    {
                        AddStateLine($"[{contactDisplayName}] is no more typing in ANOTHER conversation.");
                    }
                }
            }
        }