Ejemplo n.º 1
0
        /// <summary>
        /// Syncs 2 post, raising property change event if necessary
        /// </summary>
        /// <param name="newPost"></param>
        public void SyncWithPost(ActivityPost newPost)
        {
            if (UpdatedTime != newPost.UpdatedTime)
            {
                UpdatedTime = newPost.UpdatedTime;
                this.NotifyPropertyChanged(PropertyChanged, o => o.UpdatedTime);
            }

            if (string.Compare(Message, newPost.Message, StringComparison.OrdinalIgnoreCase) != 0)
            {
                Message = newPost.Message;
                this.NotifyPropertyChanged(PropertyChanged, o => o.Message);
            }

            if (CanLike != newPost.CanLike)
            {
                CanLike = newPost.CanLike;
                this.NotifyPropertyChanged(PropertyChanged, o => o.CanLike);
            }

            if (HasLiked != newPost.HasLiked)
            {
                HasLiked = newPost.HasLiked;
                this.NotifyPropertyChanged(PropertyChanged, o => o.HasLiked);
            }

            if (!Likes.Equals(newPost.Likes))
            {
                Likes = newPost.Likes;
                this.NotifyPropertyChanged(PropertyChanged, o => o.Likes);
            }

            if (CanComment != newPost.CanComment)
            {
                CanComment = newPost.CanComment;
                this.NotifyPropertyChanged(PropertyChanged, o => o.CanComment);
            }

            if (CanRemoveComments != newPost.CanRemoveComments)
            {
                CanRemoveComments = newPost.CanRemoveComments;
                this.NotifyPropertyChanged(PropertyChanged, o => o.CanRemoveComments);
            }

            if (CommentCount != newPost.CommentCount)
            {
                CommentCount = newPost.CommentCount;
                Comments     = newPost.Comments;
                this.NotifyPropertyChanged(PropertyChanged, o => o.CommentCount);
            }
            else
            {
                if (Comments.Count > 0 && (newPost.Comments.Count != Comments.Count ||
                                           (Comments[0].Time != newPost.Comments[0].Time ||
                                            Comments[Comments.Count - 1].Time != newPost.Comments[Comments.Count - 1].Time)))
                {
                    Comments = newPost.Comments;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a ActivityPost object
 /// </summary>
 /// <param name="post"></param>
 internal ActivityPost(FacebookStreamPost post)
 {
     CreatedTime       = post.CreatedTime;
     UpdatedTime       = post.UpdatedTime;
     Message           = post.Message;
     ActorUserId       = post.ActorId;
     TargetUserId      = !string.IsNullOrEmpty(post.TargetId) ? long.Parse(post.TargetId) : new Nullable <long>();
     CanLike           = post.Likes.CanLikes;
     HasLiked          = post.Likes.UserLikes;
     Likes             = new ActivityPostLikes(post.Likes);
     CanComment        = post.StreamComments != null ? post.StreamComments.CanPost : false;
     CanRemoveComments = post.StreamComments != null ? post.StreamComments.CanRemove : false;
     CommentCount      = post.StreamComments != null ? post.StreamComments.Count : 0;
     PostId            = post.PostId;
     Type        = post.Type;
     Attribution = post.Attribution;
     AppId       = post.AppId;
     Attachment  = new ActivityPostAttachment(post.Attachment);
     if (post.StreamComments != null)
     {
         _comments = new ActivityCommentCollection(post.StreamComments.Comments);
     }
     Likes.ProfileInfoChangeEvent += new EventHandler <EventArgs>(Likes_ProfileInfoChangeEvent);
     //FilterKey = post.FilterKey;
     //Permalink = post.Permalink;
 }
Ejemplo n.º 3
0
        void OnGetCommentsCompleted(ActivityCommentCollection comments, Object state, FacebookException e)
        {
            if ((e != null))
            {
                return;
            }

            Comments = comments;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a ActivityPost object
 /// </summary>
 /// <param name="post"></param>
 internal ActivityPost(stream_post post)
 {
     CreatedTime       = DateHelper.ConvertDoubleToDate(post.created_time); // TODO: Test conversion?
     UpdatedTime       = DateHelper.ConvertDoubleToDate(post.updated_time); // TODO: Test conversion?
     Message           = post.message;
     ActorUserId       = post.actor_id;
     TargetUserId      = post.target_id;
     CanLike           = post.likes.user_likes;
     HasLiked          = post.likes.user_likes;
     Likes             = new ActivityPostLikes(post.likes);
     CanComment        = post.comments.can_post;
     CanRemoveComments = post.comments.can_remove;
     CommentCount      = post.comments.count;
     PostId            = post.post_id;
     Type        = post.type;
     Attribution = post.attribution;
     AppId       = post.app_id;
     Attachment  = new ActivityPostAttachment(post.attachment);
     _comments   = new ActivityCommentCollection(post.comments.comment_list.comment);
     Likes.ProfileInfoChangeEvent += new EventHandler <EventArgs>(Likes_ProfileInfoChangeEvent);
     //FilterKey = post.filterkey;
     //Permalink = post.permalink;
 }