private static VoiceMessageItem GetLoadedVoiceMessageItem(IVirtualizable item)
        {
            VoiceMessageItem voiceMessageItem = ConversationItems.GetVoiceMessageItem(item);

            if (voiceMessageItem != null && voiceMessageItem.CurrentState != VirtualizableState.Unloaded)
            {
                return(voiceMessageItem);
            }
            return((VoiceMessageItem)null);
        }
        public void Handle(VoiceMessagePlayEndedEvent message)
        {
            if (this._messages == null || this._messages.Count == 0)
            {
                return;
            }
            Doc doc1 = message.Doc;

            if (doc1 == null || doc1.owner_id == 0L || doc1.id == 0L)
            {
                return;
            }
            int index1 = -1;

            for (int index2 = this._messages.Count - 1; index2 >= 0; --index2)
            {
                VoiceMessageItem voiceMessageItem = ConversationItems.GetLoadedVoiceMessageItem((IVirtualizable)(this._messages[index2] as MessageItem));
                Doc doc2 = voiceMessageItem != null ? voiceMessageItem.Doc : (Doc)null;
                if (voiceMessageItem != null && doc2 != null && (doc2.owner_id == doc1.owner_id && doc2.id == doc1.id))
                {
                    index1 = index2 - 1;
                    break;
                }
            }
            if (index1 < 0)
            {
                return;
            }
            VoiceMessageItem voiceMessageItem1 = ConversationItems.GetLoadedVoiceMessageItem((IVirtualizable)(this._messages[index1] as MessageItem));

            if (voiceMessageItem1 == null)
            {
                return;
            }
            voiceMessageItem1.PlayPause();
        }