public void FillFriendsAttendingCollection(FriendRoot fr) { int i; for (i = 0; i < fr.data.Count; i++) { friendList.Add(fr.data[i]); } }
async private void LoadInfoBox(Event selectedEvent) { InfoBoxProgressBar.IsEnabled = true; MainMap.SetView(selectedEvent.Location, 15.0f); App.commonApiHandler.friendList.Clear(); // see RSVP status of event. try { RootObject rsvp = await App.commonApiHandler.facebookApi.GetRSVPStatusForUser(selectedEvent.eid); if (rsvp.data.Count != 0) { SetButtonToStatus(rsvp.data[0]); } else { // enable all buttons. SetButtonToStatus(null); } // git list of friends. } catch (System.Threading.Tasks.TaskCanceledException) { App.errorOccured = true; } catch (Facebook.WebExceptionWrapper) { App.errorOccured = true; } if (App.errorOccured) { try { dialog.Content = "Internet connection lost"; await dialog.ShowAsync(); } catch (Exception) {} App.errorOccured = false; } //Ensure there is content to be displayed before modifying the infobox control if (!String.IsNullOrEmpty(selectedEvent.name) || !String.IsNullOrEmpty(selectedEvent.description)) { Infobox.DataContext = selectedEvent; Infobox.Visibility = Visibility.Visible; MapLayer.SetPosition(Infobox, MapLayer.GetPosition(selectedEvent.Location)); FriendRoot vsx = await App.commonApiHandler.facebookApi.GetFriendsAttendingEvent(selectedEvent.eid); App.commonApiHandler.FillFriendsAttendingCollection(vsx); attendFr.ItemsSource = App.commonApiHandler.friendList; } else { Infobox.Visibility = Visibility.Collapsed; } InfoBoxProgressBar.IsEnabled = false; }
async void ItemDetailPage1_Loaded(object sender, RoutedEventArgs e) { bool error = false; progBar.IsIndeterminate = true; App.commonApiHandler.friendList.Clear(); FriendRoot vsx = null; try { vsx = await App.commonApiHandler.facebookApi.GetFriendsAttendingEvent(selectedEvent.eid); } catch (Facebook.WebExceptionWrapper) { error = true; } if (error) { try { MessageDialog msg = new MessageDialog("Connection Lost"); await msg.ShowAsync(); return; }catch (Exception) {} } App.commonApiHandler.FillFriendsAttendingCollection(vsx); attendFr.ItemsSource = App.commonApiHandler.friendList; // see RSVP status of event. RootObject rsvp = await App.commonApiHandler.facebookApi.GetRSVPStatusForUser(selectedEvent.eid); // git list of friends. if (rsvp.data.Count != 0) { SetButtonToStatus(rsvp.data[0]); } else { // enable all buttons. SetButtonToStatus(null); } progBar.IsIndeterminate = false; }
async void ItemDetailPage1_Loaded(object sender, RoutedEventArgs e) { App.commonApiHandler.friendList.Clear(); FriendRoot vsx = await App.commonApiHandler.facebookApi.GetFriendsAttendingEvent(selectedEvent.eid); App.commonApiHandler.FillFriendsAttendingCollection(vsx); attendFr.ItemsSource = App.commonApiHandler.friendList; // see RSVP status of event. RootObject rsvp = await App.commonApiHandler.facebookApi.GetRSVPStatusForUser(selectedEvent.eid); // git list of friends. if (rsvp.data.Count != 0) { SetButtonToStatus(rsvp.data[0]); } else { // enable all buttons. SetButtonToStatus(null); } }