protected async override void OnNavigatedTo(NavigationEventArgs e) { mid = e.Parameter.ToString(); user = await ContentServ.GetUserinfoAsync(mid); Face.ImageSource = new BitmapImage { UriSource = new Uri(user.Face) }; level.Source = new BitmapImage { UriSource = new Uri("ms-appx:///Assets//Others//lv" + user.Current_level + ".png", UriKind.Absolute) }; exp_current.Text = user.Current_exp; toutu.Source = new BitmapImage(new Uri("http://i0.hdslb.com/" + user.Toutu)); birth.Text += user.BirthDay; regdate.Text += user.RegTime; sex.Text += user.Sex; addr.Text += user.Place.Length > 0 ? user.Place : "未知"; if (user.Current_level == "6") { bar.Value = 100; } else { bar.Value = int.Parse(user.Current_exp); bar.Maximum = int.Parse(user.Next_exp); exp_total.Text = user.Next_exp; } userName.Text = user.Name; user.Sign = user.Sign; list_concern.ItemsSource = await ContentServ.GetFriendsAsync(mid);//以后得改 list_videos.ItemsSource = await ContentServ.GetMyVideoAsync(mid, 1); conlist.ItemsSource = await ContentServ.GetFriendsCons(mid, 1); }
private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { Pivot pivot = sender as Pivot; switch (pivot.SelectedIndex) { case 2: { if (!isFriendLoaded) { var list = await ContentServ.GetFriendsAsync(UserHelper.Mid, page_friend); if (list.isEmpty) { // 提示:没有关注的人 } else { for (int i = 0; i < list.List.Count; i++) { list_friends.Items.Add(list.List[i]); } } isFriendLoaded = true; } }; break; } }
private void list_friends_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var scroll = Load.FindChildOfType <ScrollViewer>(list_friends); scroll.ViewChanged += async(s, a) => { if (scroll.VerticalOffset == scroll.ScrollableHeight) { page_friend++; var result = await ContentServ.GetFriendsAsync(UserHelper.Mid, page_friend); if (list_friends.Items.Count < result.Result) { for (int i = 0; i < result.List.Count; i++) { list_friends.Items.Add(result.List[i]); } } } }; }
async Task <bool> loadfriends() { list_friends.ItemsSource = await ContentServ.GetFriendsAsync(UserHelper.mid); return(true); }