public async Task SetContent(string content) { var resourceLoader = await StringsResourcesHelpers.SafeGetForCurrentViewAsync(); using (var synth = new SpeechSynthesizer()) { if (voice != null) { synth.Voice = voice; } var stream = await synth.SynthesizeTextToStreamAsync(content); MediaElementItem.SetSource(stream, stream.ContentType); } }
public HarryPotterStoryUseCase() { repository = new StoryRepostiory(); var resourceLoader = StringsResourcesHelpers.SafeGetForCurrentViewAsync().Result; foreach (var(order, titleKey, contentKey) in ApplicationSettings.HarryPotterStoryTextResources) { repository.Add(resourceLoader.GetString(titleKey), resourceLoader.GetString(contentKey)); } AllStories = new ObservableCollection <StoryEntity>(repository.All()); InitialStory = AllStories.FirstOrDefault(); CurrentStory = new ReactivePropertySlim <StoryEntity> { Value = InitialStory }; }