Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 private void detach_target_language(VocabularyTargetLanguage entity)
 {
     NotifyPropertyChanging("TargetLanguages");
     entity.Vocabulary = null;
 }