C# Class LearnLanguages.Study.StudyItemViewModelFactory

The purpose of this class is to produce viewmodels given some input.
ファイルを表示 Open project: ibgib/LearnLanguages

Public Methods

Method Description
ProcureAsync ( PhraseEdit phrase, string nativeLanguageText ) : Task

Creates a study item using the phrase and nativeLanguageText. If the phrase.Language is the same as the native language, then this will be a study item related to studying the meaning of the phrase, all in the native language. If these two languages are different, then it will procure a translation study item. This prepares the view model so that all that is necessary for the caller is to call viewmodel.Show(...);

Private Methods

Method Description
AutoTranslate ( PhraseEdit untranslatedPhrase, string targetLanguageText ) : Task

Uses auto translation service (as of writing, this is BingTranslatorService) to translate phrase into another phrase, which is returned in the callback.

GetTranslatedPhrase ( PhraseEdit phrase, string targetLanguageText ) : Task>

First searches DB for translated phrase. If not found there, uses AutoTranslate.

Method Details

ProcureAsync() public method

Creates a study item using the phrase and nativeLanguageText. If the phrase.Language is the same as the native language, then this will be a study item related to studying the meaning of the phrase, all in the native language. If these two languages are different, then it will procure a translation study item. This prepares the view model so that all that is necessary for the caller is to call viewmodel.Show(...);
public ProcureAsync ( PhraseEdit phrase, string nativeLanguageText ) : Task
phrase PhraseEdit
nativeLanguageText string
return Task