public void LoadData(DateTime fromDate, DateTime toDate) { ResetSearchBar(); cellList = new List <LexiconItemViewModel> (); var wordRepository = new WordRepository(); var items = wordRepository.GetItemsFromTo(fromDate, toDate); foreach (var word in items) { var item = new LexiconItemViewModel() { NewWord = word.Word, WordMeaning = word.Meaning, Note = word.Note, Example = word.Example, WordFormation = word.WordFormation, ClientId = word.ClientId, Index = items.IndexOf(word) + 1, Collocation = word.Collocation, Synonym = word.Synonym, Antonym = word.Antonym, WordType = word.WordType }; cellList.Add(item); } base.LoadData(cellList); }
public void LoadData(bool today = true) { var wordRepository = new WordRepository(); learningWords = new List <WordModel> (); if (today) { SmartLearningApplication.Instance.ShowWaitDialog(); learningMode = LearningMode.SupperMemo; wordRepository.GetTodayLearningWordsAsync(CallBack); } else { var items = new List <WordModel> (); if (trainingMode == TrainingMode.Random) { items = wordRepository.GetAll().OrderBy(x => Guid.NewGuid()).Take(5).ToList(); } else if (trainingMode == TrainingMode.Today) { items = wordRepository.GetItemsFromTo(DateTime.Now.Date, DateTime.Now.Date); } else if (trainingMode == TrainingMode.Yesterday) { items = wordRepository.GetItemsFromTo(DateTime.Now.Date.AddDays(-1), DateTime.Now.Date); } foreach (var word in items) { learningWords.Add(word); learningMode = LearningMode.SelfTraning; } } SetupUI(); }