public TranslationPage(Translation translation) { _translationViewModel = new TranslationViewModel(translation); InitializeComponent(); BindingContext = _translationViewModel; Title = "YodaSpeak - Detailed view"; BtnDelete.Clicked += DeleteTranslation; }
public int SaveTranslation(Translation translation) { lock (locker) { if (translation.ID != 0) { database.Update(translation); return translation.ID; } else return database.Insert(translation); } }
private void SaveTranslation(object sender, EventArgs e) { Translation t = new Translation(); t.OriginalSentence = sentence; t.TranslatedSentence = translation; db.SaveTranslation(t); BtnSave.IsVisible = false; TxtInput.Text = ""; DisplayAlert("Translation saved!", "Saved on device your translation was!", "OK"); }
public TranslationViewModel(Translation translation) { ID = translation.ID; OriginalSentence = translation.OriginalSentence; TranslatedSentence = translation.TranslatedSentence; }