public static void Init(DataStore dataStore) { Sentences = new SentenceRepository(dataStore, "SentenceText"); Vocabulary = new VocabRepository(dataStore, "Text"); GrammarEntries = new GrammarEntryRepository(dataStore, "Text"); GrammarRoles = new GrammarRolesRepository(dataStore, "RoleName"); Users = new UserRepository(dataStore, "UserID", "Email"); Topics = new TopicRepository(dataStore, "Index", "ToicName"); Sessions = new SessionRepository(dataStore, "UserID"); }
private async void InitializeAsync() { if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { Task <IEnumerable <Sentence> > loadedSentences = SentenceRepository.GetAllSentencesAsync(); IsLoading = true; Sentences = new ObservableCollection <Sentence>((await loadedSentences).ToList()); IsLoading = false; } }
private async Task <Sentence> GetSentenceAsync(string sentence) { var sentenceRepository = new SentenceRepository(); var sentenceCreator = new SentenceCreator(); var sentenceService = new SentenceService(sentenceRepository, sentenceCreator); bool isLoaded = await sentenceService.LoadAsync(sentence); return((await sentenceRepository.GetAllAsync()).FirstOrDefault()); }
private async Task <string> ConvertBase(string text, Converter converter) { var sentenceRepository = new SentenceRepository(); var sentenceCreator = new SentenceCreator(); var sentenceService = new SentenceService(sentenceRepository, sentenceCreator); var isLoaded = await sentenceService.LoadAsync(text); await sentenceService.SortAsync(new SortAsc()); return(isLoaded ? await sentenceService.ConvertAsync(converter) : "Error!"); }
public async Task load_async_method_should_add_async_sentence_to_sentence_repository() { Sentence expected = new Sentence(new [] { "Mary", "had", "a", "little", "lamb" }); var sentenceRepository = new SentenceRepository(); var sentenceCreator = new SentenceCreator(); var sentenceService = new SentenceService(sentenceRepository, sentenceCreator); bool isLoaded = await sentenceService.LoadAsync(_sentence); var actual = (await sentenceRepository.GetAllAsync()).FirstOrDefault(); Assert.True(isLoaded); Assert.Equal(actual.Words, expected.Words); }
public SentenceController(SentenceRepository repo) { _repository = repo; }