private void btnReady_Click(object sender, RoutedEventArgs e) { VocabularyTargetLanguage tl = new VocabularyTargetLanguage { Language = App.LanguagesListModel.MotherLanguage.Code }; Vocabulary v = new Vocabulary { Description = txtVocabularyName.Text.Trim(), Language = App.LanguagesListModel.StudyLanguage.Code, IsPreloaded = true, IsUsed = true }; v.TargetLanguages.Add(tl); App.WordStorage.wordsDB.Vocabularies.InsertOnSubmit(v); App.WordStorage.wordsDB.TargetLanguages.InsertOnSubmit(tl); App.WordStorage.wordsDB.SubmitChanges(); App.VocabularyListModel.Update(); NavigationService.GoBack(); }
private IEnumerable<WordListItemModel> query(Vocabulary vocab, string filter) { Regex re = new Regex( @"\b" + filter, RegexOptions.IgnoreCase ); return from Word w in storage.Words where w.Vocabulary.ID == vocab.ID && re.IsMatch(w.Spelling) orderby w.Spelling ascending select new WordListItemModel(w, tts); }
private IEnumerable<WordListItemModel> query(Vocabulary vocab) { return from Word w in storage.Words where w.Vocabulary.ID == vocab.ID orderby w.Spelling ascending select new WordListItemModel(w, tts); }
public WordsViewModel(TextToSpeech tts, Vocabulary vocabulary) { this.usedVocabulary = vocabulary; this.tts = tts; }
public void StartNewTraining(Vocabulary vocabulary) { System.Diagnostics.Debug.WriteLine("Starting new training..."); DateTime from = DateTime.Now; WordsSelector ws = new WordsSelector(App.WordStorage, vocabulary); words.Clear(); words.AddRange(ws.SelectWordsForTraining(10)); System.Diagnostics.Debug.WriteLine("Trainign created in {0}ms", (DateTime.Now - from).TotalMilliseconds); this.NewWordsSeenCount = 0; this.CorrectAnswersCount = 0; WordsCount = 0; //words.Count; wordIndex = -1; }
public VocabularyListItemModel(Vocabulary v, VocabularyViewModel model) { this.Vocabulary = v; parentModel = model; v.PropertyChanged += OnSourceVocabularyChanged; }
private Vocabulary findOrCreate() { if (vocabulary == null) { vocabulary = "default("+languageFrom.Item1+")"; } // // Create vocabulary and vocabulary info var newVocabulary = new Vocabulary { Description = vocabulary, IsPreloaded = true, IsUsed = true, Language = languageFrom.Item1 }; // foreach( var lng in languagesTo) { var targetLanguage = new VocabularyTargetLanguage { Language = lng.Item1 }; newVocabulary.TargetLanguages.Add(targetLanguage); database.TargetLanguages.InsertOnSubmit(targetLanguage); } database.Vocabularies.InsertOnSubmit(newVocabulary); return newVocabulary; }