Exemplo n.º 1
0
        private async Task <string> processarAudioAsync(CidadaoModel cidadao, string pathAudio)
        {
            var analiadorAudio = new SpeechSynthesisService("dfe367abf6d54cccb191cc27b34d1845", "eastus", "");
            var retorno        = await analiadorAudio.RunSpeechToTextAsync(pathAudio);

            return(retorno);
        }
Exemplo n.º 2
0
        private async void pMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            string speakOut = null;

            if (this.pMain.SelectedItem == this.piCast)
            {
                speakOut = "film cast";
            }
            else if (this.pMain.SelectedItem == this.piCinema)
            {
                speakOut = "cinema details";
            }
            else if (this.pMain.SelectedItem == this.piFilmDetails)
            {
                speakOut = String.Format("overview of {0}", SelectedFilm.Title);
            }
            else if (this.pMain.SelectedItem == this.piReviews)
            {
                speakOut = "user reviews";
            }
            else
            {
                speakOut = "film performances";
            }

            await SpeechSynthesisService.SpeakOutLoud(speakOut);
        }
Exemplo n.º 3
0
        private async void RadCalendar_SelectedValueChanged(object sender, Telerik.Windows.Controls.ValueChangedEventArgs <object> e)
        {
            if (!this.viewModel.Initialised)
            {
                return;
            }

            bool hasEntries = this.viewModel.SetFilmsForDate((DateTime)e.NewValue);

            string speakOut = null;

            if (hasEntries)
            {
                SetCalenderVisibility(false);

                this.tbNoFilms.Visibility = System.Windows.Visibility.Collapsed;

                ResetLLS();

                speakOut = String.Format("listsing for {0}", this.viewModel.UserSelectedDate.ToLongDateString());
            }
            else
            {
                this.tbNoFilms.Visibility = System.Windows.Visibility.Visible;

                speakOut = String.Format("no listsing for {0}. Please check tomorrow", this.viewModel.UserSelectedDate.ToLongDateString());
            }

            if (Config.AudioSupport)
            {
                await SpeechSynthesisService.SpeakOutLoud(speakOut);
            }
        }
        private async void pMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            string speakOut = null;

            switch (this.pMain.SelectedIndex)
            {
            case 0:
                speakOut = String.Format("overview of {0}", SelectedFilm.Title);
                break;

            case 1:
                speakOut = "film cast";
                break;

            case 2:
                speakOut = "user reviews";
                break;

            default:
                speakOut = "showing at the cinemas below";
                break;
            }

            await SpeechSynthesisService.SpeakOutLoud(speakOut);
        }
        private async void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            Grid g = sender as Grid;

            MovieCastInfo cast = g.Tag as MovieCastInfo;

            if (cast != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(cast.Title);
                if (!String.IsNullOrWhiteSpace(cast.ReleaseDate))
                {
                    sb.AppendFormat("released on {0}\n", cast.ReleaseDate);
                }

                if (!String.IsNullOrWhiteSpace(cast.Character))
                {
                    sb.AppendFormat("plays {0}\n", cast.Character);
                }

                await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
            }
        }
Exemplo n.º 6
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SpeechSynthesisService.CancelExistingRequests();

            if (bLoaded)
            {
                return;
            }

            if (!Config.ShowCleanBackground)
            {
                this.LayoutRoot.Background = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri("SplashScreenImage-WVGA.jpg", UriKind.Relative)),
                    Opacity     = 0.2,
                    Stretch     = Stretch.UniformToFill
                };
            }

            List <FilmInfo> current = new List <FilmInfo>();
            List <FilmInfo> upcomig = new List <FilmInfo>();

            foreach (var film in App.Films.Values)
            {
                if (film.Release <= DateTime.UtcNow)
                {
                    current.Add(film);
                }
                else
                {
                    upcomig.Add(film);
                }
            }

            this.lstMain.IsGroupingEnabled = this.lstUpcoming.IsGroupingEnabled = Config.GroupData;

            if (Config.GroupData)
            {
                FilmData cdCurrent = new FilmData(current);

                var dataLetter = cdCurrent.GetGroupsByLetter();

                this.lstMain.ItemsSource = dataLetter.ToList();

                FilmData cdUpcoming = new FilmData(upcomig);

                var dataLetterUpcoming = cdUpcoming.GetGroupsByLetter();

                this.lstUpcoming.ItemsSource = dataLetterUpcoming.ToList();
            }
            else
            {
                this.lstMain.ItemsSource     = current;
                this.lstUpcoming.ItemsSource = upcomig;
            }

            bLoaded = true;
        }
Exemplo n.º 7
0
        private async void pMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            string speakOut = null;

            switch (this.pMain.SelectedIndex)
            {
            //case 0:
            //    speakOut = String.Format("listsing for {0}", this.viewModel.UserSelectedDate.ToLongDateString());
            //    break;

            case 1:
            case 2:
                PivotItem pi = this.pMain.SelectedItem as PivotItem;
                speakOut = String.Format("{0} films", pi.Header);
                break;

            case 3:
                speakOut = "cinema details";
                break;
            }

            await SpeechSynthesisService.SpeakOutLoud(speakOut);
        }
Exemplo n.º 8
0
        private async void Cinema_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            CinemaInfo newCI = null;

            if (sender is TextBlock)
            {
                TextBlock tb = (sender as TextBlock);
                newCI = tb.Tag as CinemaInfo;
            }
            else
            {
                Pushpin pp = (sender as Pushpin);
                newCI = pp.Tag as CinemaInfo;
            }

            if (Config.AudioSupport && ci != newCI)
            {
                ci = newCI;

                await SpeechSynthesisService.SpeakOutLoud(newCI.Name);

                return;
            }
            else
            {
                CinemaDetails.SelectedCinema = newCI;
                NavigationService.Navigate(new Uri("/CinemaDetails.xaml", UriKind.Relative));
            }
        }
Exemplo n.º 9
0
        private async Task SpeakFilmInfo(FilmInfo fi)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(fi.Title);
            sb.AppendFormat("classification {0}\n", fi.Classification);

            sb.AppendFormat("release date {0}", fi.Release.ToLongDateString());

            await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
        }
Exemplo n.º 10
0
        public void Execute()
        {
            IList <string> response = new List <string>();

            foreach (var item in GetSubCommands())
            {
                response = item.Execute(response);
                Console.WriteLine(response.FirstOrDefault());
            }
            SpeechSynthesisService.Speak("done");
        }
        private async void piPoster_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!Config.AudioSupport || p == null)
            {
                return;
            }

            if (!String.IsNullOrWhiteSpace(p.Biography))
            {
                await SpeechSynthesisService.SpeakOutLoud(p.Biography);
            }
        }
Exemplo n.º 12
0
 public void Validate(IList <string> parameters, bool isLearning)
 {
     if (string.IsNullOrEmpty(_text) && !isLearning)
     {
         SpeechSynthesisService.Speak("Please tell me what should I write down.");
         _text = SpeechRecognitionService.Listen();
     }
     if (string.IsNullOrEmpty(_label))
     {
         SpeechSynthesisService.Speak("Please tell me where you want me to save these notes.");
         _label = SpeechRecognitionService.Listen();
     }
 }
Exemplo n.º 13
0
 public void Validate(IList <string> parameters, bool isLearning)
 {
     if (string.IsNullOrEmpty(_sourceLanguage))
     {
         SpeechSynthesisService.Speak("From what language do you want me to translate");
         var lang = SpeechRecognitionService.Listen();
         _sourceLanguage = Languages.GetLanguage(lang);
     }
     if (string.IsNullOrEmpty(_text) && !isLearning)
     {
         SpeechSynthesisService.Speak("What do you want me to translate");
         _text = SpeechRecognitionService.Listen(Languages.GetListenerLanguage(_sourceLanguage));
     }
 }
Exemplo n.º 14
0
        private async void CinemaDetails_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(SelectedCinema.Name);
            sb.AppendLine(SelectedCinema.FullAddress);

            await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
        }
        private async void pMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            if (this.pMain.SelectedIndex == 0)
            {
                await SpeechSynthesisService.SpeakOutLoud("details of " + castinfo.Name);
            }
            else
            {
                await SpeechSynthesisService.SpeakOutLoud("appearanced in films listed");
            }
        }
Exemplo n.º 16
0
        private async Task SpeakFilmInfoWithShowTimes(FilmInfo fi)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(fi.Title);
            sb.AppendFormat("classification {0}\n", fi.Classification);

            sb.Append("Performances at ");
            for (int i = 0; i < fi.Performances.Count; i++)
            {
                sb.Append(fi.Performances[i].TimeString);
                sb.Append(" ");
            }

            await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
        }
Exemplo n.º 17
0
        private async Task SpeakFilmInfo(FilmInfo fi)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(fi.Title);
            sb.AppendFormat("classification {0}\n", fi.Classification);

            //if(fi.VoteCount > 0)
            //    sb.AppendFormat("average rating {0}, {1} reviews\n", fi.AverageRating.ToString("N2"), fi.VoteCount);

            //sb.AppendFormat("release date {0}\n", fi.Release.ToLongDateString());

            //if(fi.Runtime > 0)
            //    sb.AppendFormat("duration {0} minutes\n", fi.Runtime);

            //sb.AppendFormat("short description {0}", fi.Overview);

            await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
        }
Exemplo n.º 18
0
        private async void pMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            if (this.pMain.SelectedItem == null)
            {
                return;
            }

            PivotItem pi = this.pMain.SelectedItem as PivotItem;

            if (pi == null)
            {
                return;
            }

            await SpeechSynthesisService.SpeakOutLoud((string)pi.Header + " films");
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SpeechSynthesisService.CancelExistingRequests();

            this.SpinAndWait(true);

            TMDBService tmdb = new TMDBService();

            if (App.TMDBConfig == null)
            {
                App.TMDBConfig = await tmdb.GetConfig();
            }

            p = await tmdb.GetPersonDetails(castinfo.ID);

            this.LoadPersonDetails(p);

            this.SpinAndWait(false);
        }
Exemplo n.º 20
0
        protected async override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SpeechSynthesisService.CancelExistingRequests();

            if (!Config.ShowCleanBackground)
            {
                this.LayoutRoot.Background = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri("SplashScreenImage-WVGA.jpg", UriKind.Relative)),
                    Opacity     = 0.2,
                    Stretch     = Stretch.UniformToFill
                };
            }
            else
            {
                this.LayoutRoot.Background = new SolidColorBrush(Colors.Transparent);
            }

            await ExecuteInitialDataLoad();
        }
        private async void Cinema_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            TextBlock  tb        = (sender as TextBlock);
            CinemaInfo newCinema = (tb.Tag as CinemaInfo);

            if (Config.AudioSupport && cinema != newCinema)
            {
                cinema = newCinema;

                await SpeechSynthesisService.SpeakOutLoud(newCinema.Name);

                return;
            }
            else
            {
                ShowPerformances.SelectedCinema    = newCinema;
                ShowPerformances.SelectedFilm      = SelectedFilm;
                ShowPerformances.ShowCinemaDetails = true;
                ShowPerformances.ShowFilmDetails   = false;
                NavigationService.Navigate(new Uri("/ShowPerformances.xaml", UriKind.Relative));
            }
        }
Exemplo n.º 22
0
        private async void ListForDay_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!Config.AudioSupport)
            {
                return;
            }

            StackPanel sp = (sender as StackPanel);
            Group <PerformanceInfo> performances = sp.Tag as Group <PerformanceInfo>;

            if (performances != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Performance for {0}\n", performances.GroupTitle);

                foreach (var entry in performances)
                {
                    sb.Append(entry.TimeString);
                    sb.AppendFormat(" ");
                }

                await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
            }
        }
Exemplo n.º 23
0
        private async Task SpeakOutLoud(object sender)
        {
            StringBuilder sb = new StringBuilder();

            if (sender is ButtonBase)
            {
                ButtonBase buttonbase = (sender as ButtonBase);
                Grid       g          = buttonbase.Content as Grid;

                GetTextContent(sb, g);
            }
            else if (sender is HubTileBase)
            {
                HubTileBase t = sender as HubTileBase;
                sb.AppendLine(t.Name);
                //GetTextContent(sb, t.Name as Grid);
                //GetTextContent(sb, t.BackContent as Grid);
            }

            if (sb.Length > 0)
            {
                await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
            }
        }
        protected async override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SpeechSynthesisService.CancelExistingRequests();

            if (bLoaded)
            {
                return;
            }

            int iFilm = int.MinValue;

            if (this.NavigationContext.QueryString.ContainsKey("FilmID") && SelectedFilm == null)
            {
                iFilm = int.Parse(this.NavigationContext.QueryString["FilmID"]);
            }
            else
            {
                iFilm = SelectedFilm.EDI;
            }

            bool bError = false;

            try
            {
                if (App.Films == null || App.Films.Count == 0)
                {
                    LocalStorageHelper lsh = new LocalStorageHelper();
                    await lsh.DownloadFiles(false);

                    await lsh.DeserialiseObjects();
                }

                SelectedFilm = App.Films[iFilm];
            }
            catch (Exception ex)
            {
                bError = true;
            }

            if (bError)
            {
                MessageBox.Show("Error fetching film details");
            }

            this.abibTrailer = new ApplicationBarIconButton()
            {
                Text = "trailer", IconUri = new Uri("/Images/appbar.transport.play.rest.png", UriKind.Relative)
            };
            this.abibTrailer.Click += this.btnViewTrailer_Click;

            this.abibShare = new ApplicationBarIconButton()
            {
                Text = "share", IconUri = new Uri("/Images/appbar.share03.png", UriKind.Relative)
            };
            this.abibShare.Click += this.btnShare_Click;

            this.abibSoundTrack = new ApplicationBarIconButton()
            {
                IconUri = new Uri("/Images/appbar.notes.rest.png", UriKind.Relative), Text = "sounds track"
            };
            this.abibSoundTrack.Click += abibSoundTrack_Click;

            if (!Config.ShowCleanBackground)
            {
                if (SelectedFilm.BackdropUrl != null)
                {
                    this.pMain.Background = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(SelectedFilm.BackdropUrl),
                        Opacity     = 0.2,
                        Stretch     = Stretch.UniformToFill
                    };
                }
                else if (SelectedFilm.MediumPosterUrl != null)
                {
                    this.LayoutRoot.Background = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(SelectedFilm.MediumPosterUrl),
                        Opacity     = 0.2,
                        Stretch     = Stretch.UniformToFill
                    };
                }
            }

            LoadFilmDetails();

            this.ApplicationBar.Buttons.Clear();

            if (!String.IsNullOrWhiteSpace(SelectedFilm.YoutubeTrailer))
            {
                this.ApplicationBar.Buttons.Add(this.abibTrailer);
            }

            this.ApplicationBar.Buttons.Add(this.abibSoundTrack);

            this.ApplicationBar.Buttons.Add(this.abibShare);

            YouTube.CancelPlay();

            bLoaded = true;
        }
 private async Task SpeakCastInfo(CastInfo ci)
 {
     await SpeechSynthesisService.SpeakOutLoud(ci.Title);
 }