// When user clicks on event type private async void ClassificationBox_Tapped(object sender, TappedRoutedEventArgs e) { // get event type var classificationName = ((TextBlock)sender).Text; // remove events from collection Events.Clear(); try { // Loop through each element that is return from the GetEventsByCountryId method // and append them to the observable collection foreach (var eventThing in await TicketMasterData.GetEventsByClassifcation(classificationName)) { Events.Add(eventThing); } } catch { // If there is an exception alert user ExceptionDialogBox(); for (int i = 0; i < 100; i++) { Events.Add(new Event { name = "Event Name", venueName = "Venue Name", image = null, id = "0" }); } } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { try { // Loop through each element that is return from the GetEventsByCountryId method // and append them to the observable collection foreach (var eventThing in await TicketMasterData.GetEventsByCountryId("IE")) { Events.Add(eventThing); } } catch { // If there is an exception display dialog box to warn user ExceptionDialogBox(); // Add 100 empty events to the grid for (int i = 0; i < 100; i++) { // eventId is set to 0 Events.Add(new Event { name = "Event Name", venueName = "Venue Name", image = null, id = "0" }); } } }
// When user clicks on Item in ComboBox private async void CountryBox_Tapped(object sender, TappedRoutedEventArgs e) { // get countryCode of TextBlock var countryCode = ((TextBlock)sender).Tag; // Remove all previous events from the page Events.Clear(); try { // Loop through each element that is return from the GetEventsByCountryId method // and append them to the observable collection foreach (var eventThing in await TicketMasterData.GetEventsByCountryId((string)countryCode)) { Events.Add(eventThing); } } catch { // If there is an exception display dialog box to warn user ExceptionDialogBox(); for (int i = 0; i < 100; i++) { Events.Add(new Event { name = "Event Name", venueName = "Venue Name", image = null, id = "0" }); } } }