Пример #1
0
 public void AddTranslationWithExternalId(int external_id_,string str_translation,SpeechParts part)
 {
     
     TranslationOfWord translation = translations.Where(x => x.external_id == external_id_).FirstOrDefault();
     if (translation == null)
     {
         translation = new TranslationOfWord();
         translations.Add(translation);
         
     }
     translation.external_id = external_id_;
     translation.translation = str_translation;
     translation.speechpart = part;
     RaisePropertyChanged(()=>translation_as_string);
 }
Пример #2
0
        public void DeleteSelectedTranslation_Cmd(TranslationOfWord transl)
        {
            transl.selected = false;
            transl.index_of_selection = 0;
            selected_translation.Remove(transl);

            int idx = 1;
            foreach (var elm in selected_translation.ToList())
            {
                elm.index_of_selection = idx;
                idx++;
            }

            EFDbContext.SaveChgs();

        }
Пример #3
0
        public WordOfDictionary(string word_,LinguaLeoAPI.TranslateAPIResponse resp) : this()
        {
            word = word_;
            outer_id = resp.word_id;
            transcription = resp.transcription;
            sound_url = resp.sound_url;
            pictures_url = resp.pic_url;

            foreach(var elm in resp.translate)
            {
                TranslationOfWord tr = new TranslationOfWord();
                tr.external_id = elm.id;
                tr.translation = elm.value;
                tr.votes = elm.votes;
                tr.picture_url = elm.pic_url;

                translations.Add(tr);
            }

            //selected_translation_ = new SynchronizedObservableCollection<TranslationOfWord>();
        }
Пример #4
0
 public void AddSelectedTranslation_Cmd(TranslationOfWord transl)
 {
     transl.selected = true;
     transl.index_of_selection = selected_translation_.Count + 1;
     selected_translation.Add(transl);
     EFDbContext.SaveChgs();
 }