public TranslationEditorViewModel(PhraseReference.Phrase phrase, TranslationReference.Translation translation) { this.TranslationResult = new TranslationReference.Translation(); this.Languages = new ObservableCollection<LanguageReference.Language>(); _currentPhraseSelected = phrase; this.Content = translation.TranslationContent; this.Description = translation.TranslationDescription; this.Language = translation.LanguageId; this.TranslationResult.TranslationId = translation.TranslationId; this.Lexicon = translation.Lexicon; _languageClient = new LanguageReference.LanguageServiceClient(); _languageClient.DisplayLanguagesCompleted += DisplayListLanguageComplete; _languageClient.DisplayLanguagesAsync(); this.ValidationMessage = string.Empty; }
private void EditPhraseComplete(object sender, PhraseReference.EditPhraseCompletedEventArgs e) { InformationViewModel informationViewModel = new InformationViewModel(); if (e.Result) _translationClient.EditTranslationAsync(_temporalPhraseTranslation); else { informationViewModel.Message = "The item was not edited, please try again"; _informationDialogService.ShowDialog<InformationViewModel>(new InformationWindow(), informationViewModel); } _phraseClient.DisplayPhrasesAsync(); }
private void DisplayListPhrasesComplete(object sender, PhraseReference.DisplayPhrasesCompletedEventArgs e) { this.Phrases.Clear(); if (_searchTerm == null) _searchTerm = string.Empty; foreach (var item in e.Result) { if (_searchTerm == string.Empty) this.Phrases.Add(item); else { //foreach (var translation in item.Translations) //{ // string temporalPhraseContentLower = translation.TranslationContent.ToLower(); // string temporalSearchTermLower = _searchTerm.ToLower(); // if (temporalPhraseContentLower.Contains(temporalSearchTermLower)) // this.Phrases.Add(item); //} } } _translationClient.DisplayTranslationsAsync(); }
private void DeletePhraseComplete(object sender, PhraseReference.DeletePhraseCompletedEventArgs e) { InformationViewModel informationViewModel = new InformationViewModel(); if (Convert.ToBoolean(e.Result.ToString())) informationViewModel.Message = "The item was deleted succesful"; else informationViewModel.Message = "The item was not deleted, please try again"; _informationDialogService.ShowDialog<InformationViewModel>(new InformationWindow(), informationViewModel); this.TranslationsComplete.Clear(); _phraseClient.DisplayPhrasesAsync(); }
public CompletePhrase(PhraseReference.Phrase phrase, TranslationReference.Translation translation) { this.Phrase = phrase; this.Translation = translation; }