Ejemplo n.º 1
0
        private async Task FindSessionsByTag(string tags)
        {
            try
            {
                var list    = _agendaService.FindSessionsByKeyword(tags);
                var results = list.Where(f => f.Value > 0).OrderByDescending(f => f.Value).Select(l => l.Key).Take(10).ToList();

                var userMessage = new VoiceCommandUserMessage();
                if (results.Any())
                {
                    userMessage.DisplayMessage = "Showing top " + results.Count() + " sessions related to " + tags;
                    userMessage.SpokenMessage  = "Showing top " + results.Count() + " sessions related to " + tags;
                }
                else
                {
                    userMessage.DisplayMessage = "There are no results for " + tags;
                    userMessage.SpokenMessage  = "There are no results for " + tags;
                }
                await ShowResults(results, userMessage);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }
Ejemplo n.º 2
0
        private void FindResults(SpeechContinuousRecognitionResultGeneratedEventArgs args)
        {
            var results = _agendaService.FindSessionsByKeyword(args.Result.Text);
            var list    = results.Where(r => r.Value > 0).OrderByDescending(r => r.Value).Take(10);

            CodecampSessions = new ObservableCollection <Session>();
            foreach (var keyValuePair in list)
            {
                CodecampSessions.Add(keyValuePair.Key);
            }
        }