Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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
            };
        }