public KeyboardHelperViewModel(Lesson lesson) { KeysDal kdal = new KeysDal(); IEqualityComparer<Key> comparer = new GkKeyEqualityComparer(); KeyModels = kdal .GetKeys() .Where(k => !k.Shifted && !k.AltGred) .ToList() .ConvertAll(k => new KeyboardHelperKeyViewModel { Key = k, Enabled = lesson.KnownChars.Contains(k, comparer) || lesson.WorkedChars.Contains(k, comparer) || k.Print.ToString() == " ", RowClass = GetRowClass(k) } ); }
public Lesson BuildPages(Lesson lesson) { lesson.LessonPages = new List<LessonPage>(); // Premiere page avec seulement les caractères à travailler lesson.LessonPages.Add(CreateAMixedPage(lesson.WorkedChars.GkToString(), 1, 0)); string knownCharSet = string.Concat(lesson.WorkedChars.GkToString(), lesson.KnownChars.GkToString()); BuildWordsListIfNeeded(knownCharSet); if (_realWordsList.Count < 6) // s'il n'y a pas beaucoup de vrais mots possibles, créer des pages de faux mots. { lesson.LessonPages.Add(CreateAMixedPage(lesson.WorkedChars.GkToString(), 1, 0)); lesson.LessonPages.Add(CreateAMixedPage(lesson.WorkedChars.GkToString(), 1, 0)); } else { lesson.LessonPages.Add(CreateAMixedPage(knownCharSet, 2, 1)); lesson.LessonPages.Add(CreateAMixedPage(knownCharSet, 1, 4)); } return lesson; }