Exemplo n.º 1
0
        public void Load(ReviewContract review, bool censor)
        {
            if (review.User != null)
            {
                this.UserName      = review.User.Name;
                this.AvatarUrl     = Avatar.GetImageUrl(review.User.Avatar);
                this.NavigationUrl = PageUrl.UserProfile(review.User.Id, review.User.Name);
            }

            var text = Html.ConvertToPlainText(review.Body).Trim();

            this.Body    = censor ? Censorship.Censor(text) : text;
            this.Created = review.Created.ParseToLocalDateTimeEnsurePast();
            DateTimeOffset createdDate;

            if (DateTimeOffset.TryParse(review.Created, out createdDate))
            {
                this.Created = createdDate.ToLocalTime().DateTime;
            }
            else
            {
                this.Created = DateTime.Now.AddSeconds(-1);
            }

            if (this.Created > DateTime.Now)
            {
                this.Created = DateTime.Now.AddSeconds(-1);
            }
        }
 public void Load(UserContract data)
 {
     this.userId        = data.Id;
     this.Name          = data.Name;
     this.Location      = data.Location;
     this.Bio           = Html.ConvertToPlainText(data.BioHtml);
     this.AvatarUrl     = Avatar.GetImageUrl(data.Avatar);
     this.NavigationUrl = PageUrl.UserProfile(this.userId, this.Name);
 }
Exemplo n.º 3
0
 private void UserButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         this.NavigationService.Navigate(PageUrl.UserProfile(this.PageViewModel.CreatedByUserId, this.PageViewModel.CreatedByUserName));
     }
     catch (InvalidOperationException)
     {
     }
 }