示例#1
0
 void AddTranslation_Execute(object parameters)
 {
     if (parameters == null)
         return;
     CompletePhrase temporalPhrase = (parameters as CompletePhrase);
     TranslationEditorViewModel editorViewModel = new TranslationEditorViewModel(temporalPhrase.Phrase, new TranslationReference.Translation());
     TranslationEditorWindow dialog = new TranslationEditorWindow(editorViewModel);
     _translationModalDialogService.ShowDialog<TranslationEditorViewModel>(dialog,
         editorViewModel,
         returnedViewModelInstance =>
         {
             if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
             {
                 TranslationReference.Translation result = editorViewModel.TranslationResult;
                 _temporalPhraseTranslation = editorViewModel.TranslationResult;
                 _translationClient.CreateTranslationAsync(result);
             }
         });
 }
示例#2
0
 void EditTranslation_Execute(object parameters)
 {
     if (parameters == null)
         return;
     CompleteTranslation temporalTranslation = (parameters as CompleteTranslation);
     foreach (var item in this.Phrases2)
     {
         if (item.Phrase.phraseId == temporalTranslation.Translation.PhraseId)
         {
             TranslationEditorViewModel editorViewModel = new TranslationEditorViewModel(item.Phrase, temporalTranslation.Translation);
             TranslationEditorWindow dialog = new TranslationEditorWindow(editorViewModel);
             _translationModalDialogService.ShowDialog<TranslationEditorViewModel>(dialog,
                 editorViewModel,
                 returnedViewModelInstance =>
                 {
                     if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                     {
                         TranslationReference.Translation result = editorViewModel.TranslationResult;
                         _temporalPhraseTranslation = editorViewModel.TranslationResult;
                         _translationClient.EditTranslationAsync(result);
                     }
                 });
             break;
         }
     }
 }
 public TranslationEditorWindow(TranslationEditorViewModel viewModel)
 {
     InitializeComponent();
     this._viewModel = viewModel;
     this.DataContext = this._viewModel;
 }