private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["statuses"] = statuses; if (e.NavigationParameter != null) { try { var t = Utils.DataConverter <Trends> .Convert(e.NavigationParameter as string); search.Text = t.query; } catch (Exception) { search.Text = e.NavigationParameter as string; } try { var list = await FanfouAPI.FanfouAPI.Instance.SearchTimeline(search.Text, SettingStorage.Instance.messageSize); statuses.Clear(); Utils.StatusesReform.append(statuses, list); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["users"] = users; try { var find = e.NavigationParameter as string; if (find != "") { search.Text = find; page = 1; var ss = await FanfouAPI.FanfouAPI.Instance.SearchUser(search.Text, SettingStorage.Instance.messageSize); users.Clear(); if (ss.users != null) { foreach (User i in ss.users) { users.Add(i); } } } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void SearchItem_Click(object sender, RoutedEventArgs e) { try { var ss = await FanfouAPI.FanfouAPI.Instance.SearchUserTimeline(search.Text, user.id, SettingStorage.Instance.messageSize); statuses.Clear(); StatusesReform.append(statuses, ss); defaultViewModel["date"] = DateTime.Now.ToString(); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["statuses"] = statuses; user = Utils.DataConverter <User> .Convert(e.NavigationParameter as string); try { page = 1; var ss = await FanfouAPI.FanfouAPI.Instance.FavoritesId(user.id, SettingStorage.Instance.messageSize, page); statuses.Clear(); StatusesReform.append(statuses, ss); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["statuses"] = statuses; user = Utils.DataConverter <User> .Convert(e.NavigationParameter as string); title.Text = user.screen_name + "的时间线"; try { var ss = await FanfouAPI.FanfouAPI.Instance.StatusHomeTimeline(SettingStorage.Instance.messageSize, id : user.id); statuses.Clear(); StatusesReform.append(statuses, ss); defaultViewModel["date"] = DateTime.Now.ToString(); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["users"] = users; page = 1; try { var ss = await FanfouAPI.FanfouAPI.Instance.FriendshipRequests(SettingStorage.Instance.messageSize, page); users.Clear(); foreach (User i in ss) { users.Add(i); } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["users"] = users; tag = e.NavigationParameter as string; title.Text = tag; page = 1; try { var ss = await FanfouAPI.FanfouAPI.Instance.Tagged(tag, SettingStorage.Instance.messageSize, page); users.Clear(); foreach (User i in ss) { users.Add(i); } defaultViewModel["date"] = DateTime.Now.ToString(); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { defaultViewModel["messages"] = messages; defaultViewModel["title"] = "我的私信"; try { page = 1; var ss = await FanfouAPI.FanfouAPI.Instance.DirectMessagesConversationList(page); if (ss.Count() != 0) { messages.Clear(); foreach (var item in ss) { messages.Add(item); } } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } }
/// <summary> /// 使用在导航过程中传递的内容填充页。 在从以前的会话 /// 重新创建页时,也会提供任何已保存状态。 /// </summary> /// <param name="sender"> /// 事件的来源; 通常为 <see cref="NavigationHelper" /> /// </param> /// <param name="e"> /// 事件数据,其中既提供在最初请求此页时传递给 /// <see cref=" Frame.Navigate1(Type, Object)" /> 的导航参数,又提供 /// 此页在以前会话期间保留的状态的 /// 字典。 首次访问页面时,该状态将为 null。 /// </param> private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { user = Utils.DataConverter <User> .Convert(e.NavigationParameter as string); if (user.index != null) { switch (user.index as string) { case "timeline": pivot.SelectedIndex = 0; break; case "favorite": pivot.SelectedIndex = 1; break; case "follower": pivot.SelectedIndex = 2; break; case "friend": pivot.SelectedIndex = 3; break; default: break; } } if (user.screen_name == null || user.screen_name == "") { try { user = await FanfouAPI.FanfouAPI.Instance.UsersShow(user.id); defaultViewModel["user"] = user; } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,请检查网络"); } } defaultViewModel["user"] = user; defaultViewModel["tags"] = tags; checkUserItem(); checkFriendship(); statuses.Clear(); favorites.Clear(); followers.Clear(); friends.Clear(); tags.Clear(); try { var ss = await FanfouAPI.FanfouAPI.Instance.StatusUserTimeline(user.id, SettingStorage.Instance.messageSize); statuses.Clear(); StatusesReform.append(statuses, ss); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,可能未公开"); } try { tags.Clear(); var list = await FanfouUWP.FanfouAPI.FanfouAPI.Instance.TaggedList(this.user.id); foreach (var item in list) { tags.Add(item); } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,可能未公开"); } favoritePage = 1; try { var ss = await FanfouAPI.FanfouAPI.Instance.FavoritesId(user.id, SettingStorage.Instance.messageSize, favoritePage); favorites.Clear(); StatusesReform.append(favorites, ss); } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,可能未公开"); } friendsPage = 1; try { var ss = await FanfouAPI.FanfouAPI.Instance.UsersFriends(user.id, SettingStorage.Instance.messageSize, friendsPage); friends.Clear(); foreach (User i in ss) { friends.Add(i); } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,可能未公开"); } followersPage = 1; try { var ss = await FanfouAPI.FanfouAPI.Instance.UsersFollowers(user.id, SettingStorage.Instance.messageSize, followersPage); followers.Clear(); foreach (User i in ss) { followers.Add(i); } } catch (Exception) { Utils.ToastShow.ShowInformation("加载失败,可能未公开"); } }