public void markMessageAsRead(ChatMessageTable msg) { msg.state = MessageState.READ; dB.InsertOrReplace(msg); msg.onChanged(); ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false)); }
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ #region --Events-- private void INSTANCE_ChatMessageChanged(ChatDBManager handler, ChatMessageChangedEventArgs args) { if (string.Equals(Chat?.id, args.MESSAGE.chatId)) { ChatMessageChanged?.Invoke(this, args); } }
private void markMessageAsRead(ChatMessageTable msg) { msg.state = MessageState.READ; update(msg); msg.onChanged(); ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg)); }
public void updateChatMessageState(string msgId, MessageState state) { dB.Execute("UPDATE " + DBTableConsts.CHAT_MESSAGE_TABLE + " SET state = ? WHERE id = ?", state, msgId); List <ChatMessageTable> list = dB.Query <ChatMessageTable>(true, "SELECT * FROM " + DBTableConsts.CHAT_MESSAGE_TABLE + " WHERE id = ?;", msgId); Parallel.ForEach(list, (msg) => { ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false)); }); }
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- public void setMessageAsDeliverd(string id, bool triggerMessageChanged) { dB.Execute("UPDATE " + DBTableConsts.CHAT_MESSAGE_TABLE + " SET state = ? WHERE id = ?", MessageState.DELIVERED, id); if (triggerMessageChanged) { ChatMessageTable msg = getChatMessageById(id); if (msg != null) { ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false)); } } }
public void setChatMessage(ChatMessageTable message, bool triggerNewChatMessage, bool triggerMessageChanged) { dB.InsertOrReplace(message); if (triggerNewChatMessage) { NewChatMessage?.Invoke(this, new NewChatMessageEventArgs(message)); if (message.isImage && !Settings.getSettingBoolean(SettingsConsts.DISABLE_IMAGE_AUTO_DOWNLOAD)) { cacheImage(message); } } if (triggerMessageChanged) { ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message, false)); } }
public void setChatMessage(ChatMessageTable message, bool triggerNewChatMessage, bool triggerMessageChanged) { update(message); if (triggerNewChatMessage) { NewChatMessage?.Invoke(this, new NewChatMessageEventArgs(message)); if (message.isImage) { cacheImage(message); } } if (triggerMessageChanged) { ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message)); } }
public async Task deleteChatMessageAsync(ChatMessageTable message, bool triggerMessageChanged) { if (message.isImage) { await ImageDBManager.INSTANCE.deleteImageAsync(message); } if (string.Equals(message.type, DirectMUCInvitationMessage.TYPE_MUC_DIRECT_INVITATION)) { deleteMucDirectInvite(message); } dB.Delete(message); if (triggerMessageChanged) { ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message, true)); } }
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- #endregion //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ #region --Misc Methods (Public)-- /// <summary> /// Triggers the ChatMessageChanged event. /// </summary> public void onChanged() { ChatMessageChanged?.Invoke(this, new EventArgs()); }