public async void UpdateFavoriteWords(string word) { word = word.ToLower(); if (_lstTranslatedWords.Count == 0) { _lstTranslatedWords = await DataHelperFavoriteWords.LoadListWords(); } int ind = _lstFavoriteWords.FindIndex(x => x.Equals(word)); // Word not found if (ind == -1) { _lstFavoriteWords.Insert(0, word); // if (_lstFavoriteWords.Count > 10) // { // _lstFavoriteWords.RemoveAt(11); // } } // Have been word else { _lstFavoriteWords.RemoveAt(ind); _lstFavoriteWords.Insert(0, word); } await DataHelperFavoriteWords.SaveListWords(_lstFavoriteWords); //_lstTranslatedWords.Clear(); }
public async Task UpdateFavoriteWords() { await DataHelperFavoriteWords.SaveListWords(_lstFavoriteWords); }
public async Task <List <string> > LoadFavoriteWords() { _lstFavoriteWords = await DataHelperFavoriteWords.LoadListWords(); return(_lstFavoriteWords); }