Exemplo n.º 1
0
        public EditorViewModel(CompletePhrase phrase)
        {
            this.PhraseResult = new PhraseReference.Phrase();
            this.PhraseResult.phraseId = phrase.Phrase.phraseId;
            this.PhraseResult.AutorId = phrase.Phrase.AutorId;
            this.PhraseResult.OriginId = phrase.Phrase.OriginId;
            this.PhraseResult.TranslationId = phrase.Phrase.TranslationId;

            this.TranslationResult = new TranslationReference.Translation();
            this.TranslationResult.TranslationId = phrase.Translation.TranslationId;
            this.TranslationResult.LanguageId = phrase.Translation.LanguageId;
            this.TranslationResult.Lexicon = phrase.Translation.Lexicon;
            this.TranslationResult.TranslationContent = phrase.Translation.TranslationContent;
            this.TranslationResult.TranslationDescription = phrase.Translation.TranslationDescription;
            this.TranslationResult.TranslationFirstLetter = phrase.Translation.TranslationFirstLetter;
            this.TranslationResult.PhraseId = phrase.Translation.PhraseId;
            this.TranslationResult.PhraseByDefault = phrase.Translation.PhraseByDefault;

            this.Languages = new ObservableCollection<LanguageReference.Language>();
            this.Autors = new ObservableCollection<AutorReference.Autor>();
            this.Origins = new ObservableCollection<OriginReference.Origin>();
            this.ValidationMessage = string.Empty;

            _languageClient = new LanguageReference.LanguageServiceClient();
            _languageClient.DisplayLanguagesCompleted += DisplayListLanguageComplete;
            _languageClient.DisplayLanguagesAsync();

            _autorClient = new AutorReference.AutorServiceClient();
            _autorClient.DisplayAutorsCompleted += DisplayListAutorComplete;
            _autorClient.DisplayAutorsAsync();

            _originClient = new OriginReference.OriginServiceClient();
            _originClient.DisplayOriginsCompleted += DisplayListOriginComplete;
            _originClient.DisplayOriginsAsync();
        }
Exemplo n.º 2
0
 void AddPhrase_Execute(object parameters)
 {
     CompletePhrase temporalPhrase = new CompletePhrase(new PhraseReference.Phrase(), new TranslationReference.Translation());
     temporalPhrase.Translation.PhraseByDefault = true;
     EditorViewModel editorViewModel = new EditorViewModel(temporalPhrase);
     EditorWindow dialog = new EditorWindow(editorViewModel);
     _modalDialogService.ShowDialog<EditorViewModel>(dialog,
         editorViewModel,
         returnedViewModelInstance =>
         {
             if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
             {
                 PhraseReference.Phrase result = editorViewModel.PhraseResult;
                 _temporalPhraseTranslation = editorViewModel.TranslationResult;
                 _phraseClient.CreatePhraseAsync(result);
             }
         });
 }
Exemplo n.º 3
0
 public void LoadTranslations(CompletePhrase completePhrase)
 {
     _lastPhraseSelected = completePhrase;
     _translationClient.DisplayTranslationsByPhraseIdAsync(completePhrase.Phrase.phraseId);
 }