void OnDelete(object sender, EventArgs e)
        {
            var            item   = (MenuItem)sender;
            TranslatorItem phrase = (TranslatorItem)item.CommandParameter;

            DictionaryPage.Items.Remove(phrase);
            DictionaryPage.Storehouse.DeletePhrase(phrase.ID);
        }
        private void PhraseList_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            TranslatorItem phrase = (TranslatorItem)e.Item;

            if (phrase.TranslatedPhraseLanguage == Language.Chinese.GetStringValue())
            {
                DisplayAlert(phrase.Phrase, phrase.Pinyin + "\n" + phrase.TranslatedPhrase, "OK");
            }
            else
            {
                DisplayAlert(phrase.Phrase, phrase.TranslatedPhrase, "OK");
            }
        }
Beispiel #3
0
        private void InitializeTranslatorParadigm(Language fromLang, Language toLang)
        {
            if (!AllowTranslation())
            {
                return;
            }

            phrase = new TranslatorItem
            {
                Phrase                   = phraseInput.Text,
                PhraseLanguage           = fromLang.GetStringValue(),
                TranslatedPhraseLanguage = toLang.GetStringValue()
            };

            App.TranslatorManager.TranslatePhrase(phrase);
        }
Beispiel #4
0
 public Task DeleteFromDictionary(TranslatorItem item)
 {
     return(translator.SaveToDictionary(item));
 }
Beispiel #5
0
 public void TranslatePhrase(TranslatorItem item)
 {
     translator.TranslatePhrase(item);
 }
Beispiel #6
0
 public TranslationChangedArgs(TranslatorItem phrase)
 {
     this.phrase = phrase;
 }
Beispiel #7
0
 public void AddPhrase(TranslatorItem phrase)
 {
     database.Insert(phrase);
 }
Beispiel #8
0
 public bool PhraseExists(TranslatorItem phrase)
 {
     return(database.Table <TranslatorItem>().Any(p => p.Phrase == phrase.Phrase));
 }
Beispiel #9
0
 public TranslatorItem GetPhrase(TranslatorItem phrase)
 {
     return(database.Table <TranslatorItem>().FirstOrDefault(p => p.Phrase == phrase.Phrase));
 }