Пример #1
0
        public void SetData(GlobalSearchItem item, UINavigationController navigationController)
        {
            this.navigationController = navigationController;
            model = item;
            if (IsNew)
            {
                btnFollow.TouchUpInside += (sender, e) =>
                {
                    Shared.Follower.ToggleFollow(btnFollow, model, model.Id, model.Type);
                };
                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer((obj) => GoToProfile()));
                lblTitle.UserInteractionEnabled = true;
                lblTitle.AddGestureRecognizer(new UITapGestureRecognizer((obj) => GoToProfile()));
                IsNew = false;
            }
            lblTitle.Text      = item.Title;
            lblSubtitle.Text   = item.Subtitle;
            lblSubtitle.Hidden = string.IsNullOrEmpty(item.Subtitle);
            lblFollowers.Text  = LargeValueHelper.GetString(item.Followers) + " followers";
            Views.SetFollowed(btnFollow, item.IsFollowing);

            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
            }
        }
Пример #2
0
 public void SetData(PostShare item)
 {
     lblName.Text = item.FirstName + " " + item.LastName;
     imageTask?.Cancel(item.ProfileUrl);
     if (!string.IsNullOrEmpty(item.ProfileUrl))
     {
         imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
     }
 }
Пример #3
0
 public void SetData(PostTag item)
 {
     lblTitle.Text      = item.Title;
     lblSubtitle.Text   = item.Subtitle;
     lblSubtitle.Hidden = string.IsNullOrEmpty(item.Subtitle);
     imageTask?.Cancel(item.ProfileUrl);
     if (!string.IsNullOrEmpty(item.ProfileUrl))
     {
         imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
     }
 }
        public void SetData(AthleteTeam item)
        {
            lblSport.Text  = item.SportName;
            lblSchool.Text = item.SchoolName;

            imageTask?.Cancel(item.ProfilePublicUrl);
            if (!string.IsNullOrEmpty(item.ProfilePublicUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfilePublicUrl, imgProfile, "DefaultProfile");
            }
        }
        public void SetData(Ranking item, int position, Action <int, UIButton> followClicked, UINavigationController navigationController)
        {
            this.item          = item;
            pos                = position;
            this.followClicked = followClicked;


            if (isNew)
            {
                btnFollow.TouchUpInside += (sender, e) =>
                {
                    this.followClicked?.Invoke(pos, btnFollow);
                };

                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToTeamProfile(navigationController, this.item.TeamId, false);
                }));

                lblName.UserInteractionEnabled = true;
                lblName.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToTeamProfile(navigationController, this.item.TeamId, false);
                }));

                isNew = false;
            }

            lblName.Text = item.TeamName;
            lblRank.Text = item.Rank.ToString();

            imageTask?.Cancel(item.ProfileUrl);

            if (item.IsActive)
            {
                btnFollow.Hidden = false;
                lblRecord.Text   = item.Wins + "W " + item.Loses + "L " + item.Ties + "T";
            }
            else
            {
                btnFollow.Hidden = true;
                lblRecord.Text   = "This profile is not active yet";
            }


            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile");
            }

            Views.SetFollowed(btnFollow, item.IsFollowing);
        }
        void SetView(string profileUrl, string name, string subtitle, bool isAthlete, int position, Action <int, UIButton> followClicked, bool isFollowed, UINavigationController navigationController, string id)
        {
            this.Id            = id;
            this.isAthlete     = isAthlete;
            pos                = position;
            this.followClicked = followClicked;
            if (isNew)
            {
                btnFollow.TouchUpInside += (sender, e) =>
                {
                    this.followClicked?.Invoke(pos, btnFollow);
                };

                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    if (this.isAthlete)
                    {
                        Navigator.GoToUserProfile(navigationController, this.Id);
                    }
                    else
                    {
                        Navigator.GoToTeamProfile(navigationController, this.Id, false);
                    }
                }));

                lblName.UserInteractionEnabled = true;
                lblName.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    if (this.isAthlete)
                    {
                        Navigator.GoToUserProfile(navigationController, this.Id);
                    }
                    else
                    {
                        Navigator.GoToTeamProfile(navigationController, this.Id, false);
                    }
                }));

                isNew = false;
            }

            lblName.Text    = name;
            lblAthlete.Text = subtitle;
            imageTask?.Cancel(profileUrl);
            if (!string.IsNullOrEmpty(profileUrl))
            {
                imageTask = new ImageLoaderHelper(profileUrl, imgProfile, "DefaultProfile", null, isAthlete ? new CircleTransformation() : null);
            }

            Views.SetFollowed(btnFollow, isFollowed);
        }
        public void SetData(EventProfile item, List <string> events)
        {
            string lang          = CultureInfo.CurrentCulture.Name;
            var    abbreviations = TZNames.GetAbbreviationsForTimeZone(item.TimezoneId, lang);
            string lblTimeZone   = abbreviations.Standard;

            DateTime eventDate = ConvertToUTC(item.DateOfEventUtc, item.TimezoneId);

            lblSportName.Text = item.SportName;
            lblDate.Text      = eventDate.ToString("h:mm tt") + " " + lblTimeZone;
            lblTeam1.Text     = item.Team1Name;
            lblTeam2.Text     = item.Team2Name;

            lblEventName.Text = item.Name;

            team1Task?.Cancel(item.Team1Url);
            if (!string.IsNullOrEmpty(item.Team1Url))
            {
                team1Task = new ImageLoaderHelper(item.Team1Url, imgTeam1, "DefaultProfile");
            }

            team2Task?.Cancel(item.Team2Url);
            if (!string.IsNullOrEmpty(item.Team2Url))
            {
                team2Task = new ImageLoaderHelper(item.Team2Url, imgTeam2, "DefaultProfile");
            }

            if (events.Contains(item.Id))
            {
                imgTagged.Image = UIImage.FromBundle("IconChecked");
            }
            else
            {
                imgTagged.Image = UIImage.FromBundle("IconUnchecked");
            }

            if (item.TeamCount == 2)
            {
                vwTeam1.Hidden     = false;
                vwTeam2.Hidden     = false;
                vwEventName.Hidden = true;
            }
            else
            {
                vwTeam1.Hidden     = true;
                vwTeam2.Hidden     = true;
                vwEventName.Hidden = false;
            }
        }
Пример #8
0
        public void SetData(FeedItem item)
        {
            Item = item;
            if (isNew)
            {
                AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    if (!string.IsNullOrEmpty(Item.AdvertisementUrl))
                    {
                        if (!Item.AdvertisementUrl.ToLower().StartsWith("http"))
                        {
                            Item.AdvertisementUrl = "http://" + Item.AdvertisementUrl;
                        }
                        UIApplication.SharedApplication.OpenUrl(new NSUrl(Item.AdvertisementUrl));
                    }
                }));
                isNew = false;
            }

            imgImage.RemoveConstraints(imgImage.Constraints);
            imgImage.AddConstraint(NSLayoutConstraint.Create(imgImage, NSLayoutAttribute.Height, NSLayoutRelation.Equal, imgImage, NSLayoutAttribute.Width, (nfloat)item.ImageAspectRatio, 0));

            lblName.Text = item.Username;
            profileTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                profileTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, AppDelegate.DefaultProfileString);
            }

            lblContent.Text = item.Content;
            if (string.IsNullOrEmpty(lblContent.Text))
            {
                lblContent.Superview.Hidden = true;
            }
            else
            {
                lblContent.Superview.Hidden = false;
            }

            imageTask?.Cancel(item.ImageUrl);
            if (!string.IsNullOrEmpty(item.ImageUrl))
            {
                imageTask = new ImageLoaderHelper(item.ImageUrl, imgImage, "IconNoImage");
            }
        }
        public void SetData(Follower item)
        {
            model = item;
            if (isNew)
            {
                btnFollow.TouchUpInside += (sender, e) =>
                {
                    Shared.Follower.ToggleFollow(btnFollow, model, model.Id, FeedType.User);
                };
            }

            lblName.Text = item.FirstName + " " + item.LastName;
            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
            }
        }
        public void SetData(UserNotification item, UINavigationController navigationController)
        {
            this.navigationController = navigationController;
            model = item;
            if (IsNew)
            {
                IsNew = false;
            }
            lblTitle.Text = item.Title;

            vwIsNew.Hidden = item.IsRead;

            lblTimeAgo.Text = TimeAgoHelper.GetTimeAgo(item.DateCreatedUtc);

            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
            }
        }
Пример #11
0
        public void SetData(PostAsAdminProfile item, Action <PostAsAdminProfile> itemClicked)
        {
            if (IsNew)
            {
                UserInteractionEnabled = true;
                AddGestureRecognizer(new UITapGestureRecognizer((obj) =>
                {
                    itemClicked?.Invoke(model);
                }));
                IsNew = false;
            }
            model            = item;
            lblTitle.Text    = item.Title;
            lblSubtitle.Text = item.SubTitle;

            imageTask?.Cancel(item.Url);
            if (!string.IsNullOrEmpty(item.Url))
            {
                imageTask = new ImageLoaderHelper(item.Url, imgProfile, "DefaultProfile");
            }
        }
Пример #12
0
        public void SetData(Profile item, List <string> schools, List <string> teams, List <string> sports)
        {
            lblTitle.Text = item.Name;

            lblSubTitle.Hidden = string.IsNullOrEmpty(item.SubTitle);
            lblSubTitle.Text   = item.SubTitle ?? "";


            if (schools.Contains(item.Id) || teams.Contains(item.Id) || sports.Contains(item.Id))
            {
                imgTagged.Image = UIImage.FromBundle("IconChecked");
            }
            else
            {
                imgTagged.Image = UIImage.FromBundle("IconUnchecked");
            }

            imageTask?.Cancel(item.ProfilePublicUrl);
            if (!string.IsNullOrEmpty(item.ProfilePublicUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfilePublicUrl, imgProfile, "DefaultProfile");
            }
        }
Пример #13
0
        public void SetData(Comment item, Action <Comment, UIButton, UILabel> likeClicked, Action <Comment> replyClicked)
        {
            model = item;
            if (IsNew)
            {
                btnLike.TouchUpInside  += (sender, e) => likeClicked?.Invoke(model, btnLike, lblLikes);
                btnReply.TouchUpInside += (sender, e) => replyClicked?.Invoke(model);
                IsNew = false;
            }
            lblResponseTo.Text = "Response to " + item.RepliedToUsername;
            lblName.Text       = item.Username;
            lblTimeAgo.Text    = TimeAgoHelper.GetTimeAgo(item.DateCreatedUtc);
            lblContent.Text    = item.Content;
            lblLikes.Text      = item.LikeCount.ToString();
            lblReplies.Text    = item.ReplyCount.ToString();

            if (string.IsNullOrEmpty(item.ParentCommentId))
            {
                BackgroundColor = UIColor.White;
                lblResponseTo.Superview.Hidden = true;
                lblReplies.Superview.Hidden    = false;
            }
            else
            {
                BackgroundColor = UIColor.FromRGB(241, 241, 241);
                lblResponseTo.Superview.Hidden = false;
                lblReplies.Superview.Hidden    = true;
            }

            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
            }

            btnLike.SetImage(UIImage.FromBundle(item.IsLiked ? "IconIsLiked" : "IconLike"), UIControlState.Normal);
        }
Пример #14
0
        public void SetData(AthleteItem item, int position, Action <int, UIButton> followClicked, UINavigationController navigationController)
        {
            this.item = item;
            pos       = position;
            if (isNew)
            {
                btnFollow.TouchUpInside += (sender, e) =>
                {
                    followClicked?.Invoke(pos, btnFollow);
                };

                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToUserProfile(navigationController, this.item.Id);
                }));

                lblName.UserInteractionEnabled = true;
                lblName.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToUserProfile(navigationController, this.item.Id);
                }));

                isNew = false;
            }
            lblName.Text = item.Name;
            lblTeam.Text = item.SchoolName + " " + item.SportName;

            Views.SetFollowed(btnFollow, item.IsFollowing);

            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
            }
        }
Пример #15
0
        public void SetData(Ranking item, Action <Ranking, UIButton> followClicked, UINavigationController navigationController)
        {
            if (boldAttributes == null)
            {
                boldAttributes                 = new UIStringAttributes();
                boldAttributes.Font            = UIFont.BoldSystemFontOfSize(btnShowRankings.Font.PointSize);
                boldAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);
            }
            if (boldAttributes == null)
            {
                regularAttributes                 = new UIStringAttributes();
                regularAttributes.Font            = UIFont.SystemFontOfSize(btnShowRankings.Font.PointSize);
                regularAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);
            }

            this.item = item;
            if (IsNew)
            {
                btnShowRankings.SetTitleColor(UIColor.FromRGB(144, 144, 144), UIControlState.Normal);
                btnFollow.TouchUpInside       += (sender, e) => followClicked?.Invoke(this.item, btnFollow);
                btnShowRankings.TouchUpInside += (sender, e) =>
                {
                    Navigator.GoToSportProfile(navigationController, this.item.SportId, true);
                };
                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToTeamProfile(navigationController, this.item.TeamId, false);
                }));

                lblTeamName.UserInteractionEnabled = true;
                lblTeamName.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Navigator.GoToTeamProfile(navigationController, this.item.TeamId, false);
                }));
                IsNew = false;
            }

            lblRank.Text      = item.Rank.ToString();
            lblSportName.Text = item.SportName;
            lblTeamName.Text  = item.TeamName;
            lblDate.Text      = item.DateUpdatedUtc.ToString("dd MMMM");

            NSMutableAttributedString attributedString = new NSMutableAttributedString("Show ", regularAttributes);

            attributedString.Append(new NSMutableAttributedString(item.SportName, boldAttributes));
            attributedString.Append(new NSMutableAttributedString(" Rankings", regularAttributes));
            btnShowRankings.SetAttributedTitle(attributedString, UIControlState.Normal);

            if (item.IsActive)
            {
                btnFollow.Hidden   = false;
                lblWinsLosses.Text = item.Wins + "W " + item.Loses + "L " + item.Ties + "T";
                if (item.IsFollowing)
                {
                    btnFollow.SetTitle("Following", UIControlState.Normal);
                    btnFollow.Layer.BorderWidth = 0;
                    btnFollow.SetTitleColor(UIColor.White, UIControlState.Normal);
                    btnFollow.BackgroundColor = UIColor.FromRGB(249, 95, 6);
                }
                else
                {
                    btnFollow.SetTitle("Follow", UIControlState.Normal);

                    btnFollow.Layer.BorderWidth = 1;
                    btnFollow.SetTitleColor(UIColor.FromRGB(144, 144, 144), UIControlState.Normal);
                    btnFollow.Layer.BorderColor = UIColor.FromRGB(144, 144, 144).CGColor;
                    btnFollow.Layer.BorderColor = UIColor.FromRGB(144, 144, 144).CGColor;
                    btnFollow.BackgroundColor   = UIColor.White;
                }
            }
            else
            {
                btnFollow.Hidden   = true;
                lblWinsLosses.Text = "This profile is not active yet";
            }

            imageTask?.Cancel(item.ProfileUrl);
            if (!string.IsNullOrEmpty(item.ProfileUrl))
            {
                imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile");
            }
        }
Пример #16
0
        public void SetData(ScoreModel item, Action <ScoreModel> showTeamsClicked)
        {
            if (boldAttributes == null)
            {
                boldAttributes                 = new UIStringAttributes();
                boldAttributes.Font            = UIFont.BoldSystemFontOfSize(btnShowTeams.Font.PointSize);
                boldAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);
            }
            if (boldAttributes == null)
            {
                regularAttributes                 = new UIStringAttributes();
                regularAttributes.Font            = UIFont.SystemFontOfSize(btnShowTeams.Font.PointSize);
                regularAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);
            }
            this.item = item;
            if (IsNew)
            {
                btnShowTeams.TouchUpInside += (sender, e) =>
                {
                    showTeamsClicked?.Invoke(this.item);
                };

                imgProfile.UserInteractionEnabled = true;
                imgProfile.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    Links.OpenUrl(this.item.TicketUrl);
                }));
                IsNew = false;
            }

            lblTeam1Name.Text  = item.Team1Name;
            lblTeam1Score.Text = item.Team1Score;
            lblTeam2Name.Text  = item.Team2Name;
            lblTeam2Score.Text = item.Team2Score;
            lblPostCount.Text  = item.PostCount.ToString();
            lblSportName.Text  = item.SportName;
            lblEventName.Text  = item.EventName;

            string lang          = CultureInfo.CurrentCulture.Name;
            var    abbreviations = TZNames.GetAbbreviationsForTimeZone(item.TimezoneId, lang);

            lblTimeZone.Text = abbreviations.Standard;

            if (item.IsTbd)
            {
                lblTime.Text = "TBD";
            }
            else
            {
                lblTime.Text = item.EventDate.ToString("h:mm tt");
            }

            if (item.EventDate <= DateTime.UtcNow)
            {
                imgProfile.Hidden    = true;
                lblTeam1Score.Hidden = false;
                lblTeam2Score.Hidden = false;
            }
            else
            {
                if (!string.IsNullOrEmpty(item.TicketUrl))
                {
                    imgProfile.Hidden = false;
                }
                else
                {
                    imgProfile.Hidden = true;
                }
                lblTeam1Score.Hidden = true;
                lblTeam2Score.Hidden = true;
            }

            NSMutableAttributedString attributedString = new NSMutableAttributedString("Show me all ", regularAttributes);

            attributedString.Append(new NSMutableAttributedString(item.TeamCount.ToString() + " teams", boldAttributes));
            btnShowTeams.SetAttributedTitle(attributedString, UIControlState.Normal);

            vwTwoTeams.Hidden  = item.TeamCount != 2;
            vwMoreTeams.Hidden = item.TeamCount == 2;

            team1Task?.Cancel(item.Team1Url);
            if (!string.IsNullOrEmpty(item.Team1Url))
            {
                team1Task = new ImageLoaderHelper(item.Team1Url, imgTeam1, "DefaultProfile");
            }
            else
            {
                imgTeam1.Image = UIImage.FromBundle("DefaultProfile");
            }

            team2Task?.Cancel(item.Team2Url);
            if (!string.IsNullOrEmpty(item.Team2Url))
            {
                team2Task = new ImageLoaderHelper(item.Team2Url, imgTeam2, "DefaultProfile");
            }
            else
            {
                imgTeam2.Image = UIImage.FromBundle("DefaultProfile");
            }

            sportTask?.Cancel(item.SportProfileUrl);
            if (!string.IsNullOrEmpty(item.SportProfileUrl))
            {
                sportTask = new ImageLoaderHelper(item.SportProfileUrl, imgSport, "DefaultProfile");
            }
            else
            {
                imgSport.Image = UIImage.FromBundle("DefaultProfile");
            }
        }