//--------------------------------------------------------Events:---------------------------------------------------------------------\\ #region --Events-- private void INSTANCE_ChatMessageChanged(ChatDBManager handler, ChatMessageChangedEventArgs args) { if (string.Equals(Chat?.id, args.MESSAGE.chatId)) { ChatMessageChanged?.Invoke(this, args); } }
private async void Chat_ChatMessageChanged(ChatDataTemplate chat, ChatMessageChangedEventArgs args) { if (!MODEL.IsDummy) { await MODEL.OnChatMessageChangedAsync(args.MESSAGE, args.REMOVED); } }
private async void INSTANCE_ChatMessageChanged(ChatDBManager handler, ChatMessageChangedEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (Chat != null && lastChatMessage != null && Equals(args.MESSAGE.chatId, Chat.id) && Equals(lastChatMessage.id, args.MESSAGE.id)) { showLastChatMessage(args.MESSAGE); } }); }
private async void INSTANCE_ChatMessageChanged(ChatDBManager handler, ChatMessageChangedEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (Chat != null && Equals(args.MESSAGE.chatId, Chat.id)) { Task.Run(async() => { for (int i = 0; i < chatMessages.Count; i++) { if (chatMessages[i].message != null && Equals(chatMessages[i].message.id, args.MESSAGE.id)) { // Only the main thread should update the list to prevent problems: await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => chatMessages[i].message = args.MESSAGE); } } }); } }); }