async void onUserInput(object o) { if (!IsInSsn || PupilInput.Length == 0) { return; } IsCorrect = LessonText.Contains(PupilInput); if (PupilInput.Length == 1) //!_swMain.IsRunning) // messed up with autoPause. { _swMain.Start(); _nextMeasureTime = DateTime.Now.Add(_measurePeriod); Trace.WriteLineIf(ExnLogr.AppTraceLevelCfg.TraceVerbose, $">>> {_swMain.ElapsedMilliseconds,9:N0} - StartedAt! <<< onUserInput"); } if (!IsCorrect) { SoundPlayer.PlayОw(); } else if (PupilInput.Length >= LessonLen) { await finishTheSession(); } }
void Create() { if (LessonRepository.Lessons.Where(l => l.Name == LessonName).Count() > 0) { NotifierVm nvm = new NotifierVm() { Message = "Lesson name already exists. Please choose another one.", Buttons = NotifierButtons.Ok, Title = "Invalid Entry!" }; DialogService.ShowDialog(nvm); return; } if (string.IsNullOrEmpty(LessonName)) { DialogService.ShowDialog(new NotifierVm("Lesson Name cannot be empty!.", "Invalid Entry!")); return; } if (string.IsNullOrEmpty(LessonText)) { DialogService.ShowDialog(new NotifierVm("Lesson text cannot be empyt!.", "Invalid Entry")); return; } LessonRepository.AddLesson(new UserLesson() { Name = LessonName, Text = new string(LessonText.Replace("\r", "").Replace("\n", "").Take(300).ToArray()), OwnerId = StudentRepository.Logged.Id }); DialogService.ShowDialog(new NotifierVm("Lesson created successfully!.", "Success")); Close(); }
public EditLessonViewModel(LessonText lessonText) { var lignes = lessonText.Text.Split('¶'); Text = TextOrDefalt(lignes, 0); TextLine2 = TextOrDefalt(lignes, 1); TextLine3 = TextOrDefalt(lignes, 2); TextLine4 = TextOrDefalt(lignes, 3); TextLine5 = TextOrDefalt(lignes, 4); TextLine6 = TextOrDefalt(lignes, 5); TextLine7 = TextOrDefalt(lignes, 6); Name = lessonText.Name; Level = ((int)lessonText.Level).ToString(); Language = ((int)lessonText.Language).ToString(); Order = lessonText.Order; }