public void DeleteBubbleFromChat(BubbleItem bubbleItem) { chatHistoryManager.DeleteItemById(bubbleItem.HistoryRowId); view.UpdateChat(getListBubbles()); }
private List<BubbleItem> getListBubbles() { LanguageManager languageManager = new LanguageManager(db); var languagesList = languageManager.GetDefaultData(); List<BubbleItem> resultBubbles = new List<BubbleItem>(); IEnumerable<ChatHistory> history = chatHistoryManager.ReadChatMessages(selectedChat); foreach (var item in history) { BubbleItem bubble = new BubbleItem(); bubble.HistoryRowId = item.ID; bubble.TextTo = item.TextTo; bubble.TextFrom = item.TextFrom; bubble.IsRobotResponse = string.IsNullOrEmpty(item.TextFrom); bubble.Transcription = item.Transcription; bubble.Definition = item.Definition; bubble.LanguageTo = languagesList.FirstOrDefault(t => t.ID == item.LanguageTo); bubble.LanguageFrom = languagesList.FirstOrDefault(t => t.ID == item.LanguageFrom); bubble.InFavorites = item.InFavorites; resultBubbles.Add(bubble); } return resultBubbles; }
public void InvertFavoriteState(BubbleItem bubbleItem) { var item = chatHistoryManager.GetItemForId(bubbleItem.HistoryRowId); if(item != null) { item.InFavorites = !item.InFavorites; int result = chatHistoryManager.SaveItem(item); } }