예제 #1
0
 public UserElement(string username, string firstName, string lastName, Avatar avatar)
     : base (username, string.Empty, UITableViewCellStyle.Subtitle)
 {
     var realName = firstName ?? "" + " " + (lastName ?? "");
      if (!string.IsNullOrWhiteSpace(realName))
         Value = realName;
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
     Image = Images.Avatar;
     ImageUri = avatar.ToUri(64);
 }
예제 #2
0
        public void Bind(string name, string description, string time, Avatar avatar)
        {
            TitleLabel.Text = name;
            TimeLabel.Text = time;
            ContentLabel.Text = description;
            ContentLabel.Hidden = string.IsNullOrWhiteSpace(description);
            ContentConstraint.Constant = ContentLabel.Hidden ? 0 : DefaultContentConstraintSize;

            var logoUri = avatar.ToUri(64);

            if (logoUri == null)
                MainImageView.Image = Images.Avatar;
            else
                MainImageView.SetImage(new NSUrl(logoUri.AbsoluteUri), Images.Avatar);
        }
예제 #3
0
        public void Bind(string name, string description, string repoOwner, Avatar logoUri)
        {
            RepositoryName.Text = name;
            RepositoryOwner.Text = repoOwner;
            RepositoryDescription.Hidden = string.IsNullOrWhiteSpace(description);
            RepositoryDescription.Text = description ?? string.Empty;
            ContentConstraint.Constant = RepositoryDescription.Hidden ? 0 : DefaultContentConstraint;

            var uri = logoUri.ToUri(64);

            if (uri == null)
                RepositoryImage.Image = Images.RepoPlaceholder;
            else
                RepositoryImage.SetImage(new NSUrl(uri.AbsoluteUri), Images.RepoPlaceholder);
        }
예제 #4
0
        public static void SetAvatar(this UIImageView @this, Avatar avatar, int? size = 64)
        {
            @this.Image = Images.Avatar;

            if (avatar == null)
                return;

            var avatarUri = avatar.ToUri(size);
            if (avatarUri != null)
            {
                @this.SetImage(new NSUrl(avatarUri.AbsoluteUri), Images.Avatar, (img, err, type, imageUrl) => {
                    if (img == null || err != null)
                        return;

                    if (type == SDImageCacheType.None)
                    {
                        @this.Image = Images.Avatar;
                        @this.BeginInvokeOnMainThread(() =>
                            UIView.Transition(@this, 0.25f, UIViewAnimationOptions.TransitionCrossDissolve, () => @this.Image = img, null));
                    }
                });
            }
        }