public void GetPlayerDetailById(string username) { UserRequestHelper userProfileHelper = new UserRequestHelper(); userProfileHelper.GetUserProfileByUserName(username); userProfileHelper.AsyncUserProfileComplated += (responseData, Ex) => { if (Ex == null) { #region get user profile Player playerDetail = null; if (responseData != null) playerDetail = responseData as Player; if (playerDetail != null) this.SearchUser = playerDetail; if (this.SearchUser.IsFindUser) this.DisplaySearchResult = Visibility.Visible; else this.DisplaySearchResult = Visibility.Collapsed; #endregion } else { string errorMessage = responseData.ToString(); if (!string.IsNullOrEmpty(errorMessage)) new ToastNotifyHelper().ShowCoding4FunToastNotify(errorMessage, "Tip"); } }; }
public void GetPlayerFollowers(string username, int pageIndex, int prePage, bool isDynamicLoad = false) { //start processbar _processBarHelper.StartProcessBar(); //register pages RegisterPaginationInfo(PagintaionType.ProfileFollowers, pageIndex, prePage); UserRequestHelper userProfileHelper = new UserRequestHelper(); userProfileHelper.GetUserFollowerData(username, pageIndex, prePage); userProfileHelper.AsyncUserProfileComplated += (responseData, ex) => { //end processbar _processBarHelper.EndProcessBar(); if (ex == null) { #region get user follower data UserFollower userFollowerData = null; if (responseData != null) userFollowerData = responseData as UserFollower; if (userFollowerData != null) { if(!isDynamicLoad) _userFollowersCol.Clear(); //update total pages UpdateTotalPage(PagintaionType.ProfileFollowers, userFollowerData.Pages); if (userFollowerData.Players.Count > 0) userFollowerData.Players.ForEach(queryEntity => { this._userFollowersCol.Add(queryEntity); }); } #endregion } else { string errorMessage = responseData.ToString(); if (!string.IsNullOrEmpty(errorMessage)) new ToastNotifyHelper().ShowCoding4FunToastNotify(errorMessage, "Tip"); } }; }
public void GetPlayerDetailById(string username) { //start processbar _processBarHelper.StartProcessBar(); UserRequestHelper userProfileHelper = new UserRequestHelper(); userProfileHelper.GetUserProfileByUserName(username); userProfileHelper.AsyncUserProfileComplated += (responseData, Ex) => { //end processbar _processBarHelper.EndProcessBar(); if (Ex == null) { #region get user profile Player playerDetail = null; if (responseData != null) playerDetail = responseData as Player; if (playerDetail != null) this.PlayerDetail = playerDetail; #endregion } else { string errorMessage = responseData.ToString(); if (!string.IsNullOrEmpty(errorMessage)) new ToastNotifyHelper().ShowCoding4FunToastNotify(errorMessage, "Tip"); } }; }
public void GetPlayerRecentShots(string username,int pageIndex,int prePage,bool isDynamicLoad=false) { //start processbar _processBarHelper.StartProcessBar(); //register pagncation RegisterPaginationInfo(PagintaionType.ProfileShots, pageIndex, prePage); UserRequestHelper userProfileHelper = new UserRequestHelper(); userProfileHelper.GetUserMostRecentShots(username, pageIndex, prePage); userProfileHelper.AsyncUserProfileComplated += (responseData, ex) => { //end processbar _processBarHelper.EndProcessBar(); if (ex == null) { #region get use most recent shot UserRecentShot recentShots = null; if (responseData != null) recentShots = responseData as UserRecentShot; if (recentShots != null) { if(!isDynamicLoad) _userRecentShotsCol.Clear(); //update total pages UpdateTotalPage(PagintaionType.ProfileShots, recentShots.Pages); if (recentShots.Shots.Count > 0) recentShots.Shots.ForEach(queryEntity => { #region get shot first author comment detail body ShotRequestHelper shotHelper = new ShotRequestHelper(); shotHelper.GetShotCommentById(queryEntity.Id, 1, 1); shotHelper.AsyncRequestComplated += (commentData, comEx) => { if (comEx == null) { #region get comment by shot id ShotComment firstComment = null; if (commentData != null) firstComment = commentData as ShotComment; if (firstComment.Comments.Count > 0) { string commentContent = firstComment.Comments[0].Body; commentContent = commentContent.Replace('\r', ' ').Replace('\n', ' '); if (commentContent.Length > 150) queryEntity.Comment = commentContent.Substring(0, 150) + "..."; else queryEntity.Comment = commentContent; } //format datetime BasicRequestHelper requestHelper = new BasicRequestHelper(); queryEntity.FormatDate = requestHelper.SpiltDateTimeStr(queryEntity.Created_at); #endregion } else { string errorMessage = commentData.ToString(); if (!string.IsNullOrEmpty(errorMessage)) new ToastNotifyHelper().ShowCoding4FunToastNotify(errorMessage, "Tip"); } }; #endregion this._userRecentShotsCol.Add(queryEntity); }); } #endregion } else { string errorMessage = responseData.ToString(); if (!string.IsNullOrEmpty(errorMessage)) new ToastNotifyHelper().ShowCoding4FunToastNotify(errorMessage, "Tip"); } }; }