private async Task ShowLatestNews() { string progress = "Getting the latest news..."; await ShowProgressScreen(progress); RssService feedService = new RssService(); var news = await feedService.GetNews("http://blog.qmatteoq.com/feed"); List<VoiceCommandContentTile> contentTiles = new List<VoiceCommandContentTile>(); VoiceCommandUserMessage message = new VoiceCommandUserMessage(); string text = "Here are the latest news"; message.DisplayMessage = text; message.SpokenMessage = text; foreach (FeedItem item in news.Take(5)) { VoiceCommandContentTile tile = new VoiceCommandContentTile(); tile.ContentTileType = VoiceCommandContentTileType.TitleOnly; tile.Title = item.Title; tile.TextLine1 = item.PublishDate.ToString("g"); contentTiles.Add(tile); } VoiceCommandResponse response = VoiceCommandResponse.CreateResponse(message, contentTiles); await _voiceServiceConnection.ReportSuccessAsync(response); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { Loading.IsActive = true; StorageFile file = await Package.Current.InstalledLocation.GetFileAsync("VoiceCommands.xml"); await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(file); RssService service = new RssService(); var items = await service.GetNews("http://blog.qmatteoq.com/feed"); News.ItemsSource = items; Loading.IsActive = false; }