示例#1
0
        private void ChatClient_OnDeleteMessageOccurred(object sender, Guid messageID)
        {
            ChatMessageControl message = this.MessageControls.FirstOrDefault(msg => msg.Message.ID.Equals(messageID));

            if (message != null)
            {
                message.DeleteMessage();
            }
        }
示例#2
0
        private async void ChatClient_OnDeleteMessageOccurred(object sender, Guid messageID)
        {
            await this.Dispatcher.InvokeAsync <Task>(async() =>
            {
                await this.messageUpdateLock.WaitAsync();

                ChatMessageControl message = this.MessageControls.FirstOrDefault(msg => msg.Message.ID.Equals(messageID));
                if (message != null)
                {
                    message.DeleteMessage();
                }

                this.messageUpdateLock.Release();
            });
        }
示例#3
0
 private async void ChatClient_OnDeleteMessageOccurred(object sender, ChatDeleteMessageEventModel deleteEvent)
 {
     await this.Dispatcher.InvokeAsync <Task>(async() =>
     {
         await this.messageUpdateLock.WaitAndRelease(() =>
         {
             ChatMessageControl message = this.MessageControls.FirstOrDefault(msg => msg.Message.ID.Equals(deleteEvent.id));
             if (message != null)
             {
                 message.DeleteMessage(deleteEvent.moderator?.user_name);
                 if (ChannelSession.Settings.HideDeletedMessages)
                 {
                     this.MessageControls.Remove(message);
                 }
             }
             return(Task.FromResult(0));
         });
     });
 }