public void InitDirection() { this.selectedChat = chatManager.GetItemForId(selectedChatID); Language userLang = languageManager.GetItemForId(this.selectedChat.LanguageFrom); Language robotLang = languageManager.GetItemForId(this.selectedChat.LanguageTo); direction = new TranslateDirection(this.db, new DirectionManager(this.db), languageManager); direction.SetDirection(userLang, robotLang); view.UpdateBackground("back" + robotLang.NameEng); }
public Chat FoundExistingOrCreateChat(Language robotLanguage) { //LanguageManager languageManager = new LanguageManager(db); Language userLanguage = languageManager.GetItemForNameEng("Russian"); //ChatManager chatManager = new ChatManager(db); Chat chat = chatManager.GetChatByLanguage(userLanguage, robotLanguage); if(chat == null) { chat = new Chat(); chat.LanguageFrom = userLanguage.ID; chat.LanguageCaptionFrom = userLanguage.NameLocal; chat.LanguageTo = robotLanguage.ID; chat.LanguageCaptionTo = robotLanguage.NameLocal; chat.UpdateDate = DateTime.Now; chatManager.SaveItem(chat); } return chat; }
public List<ChatHistory> ReadChatMessages(Chat chatItem) { return new List<ChatHistory>() { new ChatHistory() { ID=1, ChatID = 1, TextFrom="тест", TextTo="test", Transcription = "", InFavorites = false}, new ChatHistory() { ID=2, ChatID = 2, TextFrom="test", TextTo="тест", Transcription = "", InFavorites = false} }; }
public int SaveItem(Chat item) { return 1; }