private void UserLoaded(User obj) { App.CurrentUser = obj; Dispatcher.BeginInvoke(() => { //tbTweetCount.Text = obj.StatusesCount.ToString(CultureInfo.InvariantCulture); //tbCommentCount.Text = // obj.FavouritesCount.ToString(CultureInfo.InvariantCulture); //tbFanxCount.Text = obj.FollowersCount.ToString(CultureInfo.InvariantCulture); tbAccountName.Text = obj.Name; //tbMessageCount.Text = obj.FriendsCount.ToString(CultureInfo.InvariantCulture); }); }
/// <summary> /// 请求用户资料回调 /// </summary> /// <param name="userInfo"></param> private void GetUserInfoEnd(User userInfo) { Dispatcher.BeginInvoke(() => { _user = userInfo; UserInfo.BindInfo(userInfo); profileInfo.BindInfo(userInfo); tbIdolNum.Text = userInfo.FollowersCount.ToString(); tbFansNum.Text = userInfo.FriendsCount.ToString(); tbTweetNum.Text = userInfo.StatusesCount.ToString(); progressBar.IsIndeterminate = false; InitButton(userInfo); }); }
/// <summary> /// 初始化页面的按钮 /// </summary> /// <param name="user"></param> private void InitButton(User user) { Dispatcher.BeginInvoke(() => { IList appbarbtns = ApplicationBar.Buttons; appbarbtns.Clear(); if (!IsMyself) { //收听按钮 var IdolBtn = new ApplicationBarIconButton { //Text = user.IsMyidol ? "取消收听" : "收听", //IconUri = // new Uri( // "/Resource/Icons/" + // (user.IsMyidol ? "noidol" : "idol") + ".png", // UriKind.Relative) }; IdolBtn.Click += btnIdol_Click; appbarbtns.Add(IdolBtn); //收听我的人可以发私信 if (user.Following) { var MessageBtn = new ApplicationBarIconButton { Text = "私信", IconUri = new Uri("/Resource/Icons/message.png", UriKind.Relative) }; MessageBtn.Click += btnMessage_Click; appbarbtns.Add(MessageBtn); } //@某人 var MentioBtn = new ApplicationBarIconButton { Text = "@ta", IconUri = new Uri("/Resource/Icons/mentions.png", UriKind.Relative) }; MentioBtn.Click += btnMention_Click; appbarbtns.Add(MentioBtn); } //返回首页 var homeBtn = new ApplicationBarIconButton { Text = "首页", IconUri = new Uri("/Resource/Icons/home.png", UriKind.Relative) }; homeBtn.Click += btnHome_Click; appbarbtns.Add(homeBtn); }); }
/// <summary> /// 选中用户,跳转到详细页 /// </summary> /// <param name="t"></param> private void SelectUser(User u) { if (u != null) { Deployment.Current.Dispatcher.BeginInvoke( () => NavigationService.Navigate( new Uri(string.Format("/Profile.xaml?{0}={1}", AppSetting.UserNameParameterKey, u.Name), UriKind.Relative))); } }
/// <summary> /// 绑定用户信息 /// </summary> /// <param name="userInfo"></param> public void BindInfo(User userInfo) { Dispatcher.BeginInvoke(() => { ProfileInfoLayoutRoot.DataContext = userInfo; }); }