public void Refresh() { _posts = _postBLL.GetAllPosts(_user.Following); _new_posts = _postBLL.GetNewPosts(_user.LastLogin, _user.Following); if (_posts != null && _posts.Count > 0) { btnLike.IsEnabled = true; btnComment.IsEnabled = true; btnComments.IsEnabled = true; btnLikers.IsEnabled = true; btnNext.IsEnabled = true; btnPrev.IsEnabled = false; _is_any_posts = true; _current_post = _posts[_index_of_post]; Header.Content = _userBLL.GetUser(_current_post.OwnerId).Login; Timeline.Content = _current_post.Text; date.Content = "Posted on: " + _current_post.DateTime; //if (_index_of_post < _new_posts.Count) //{ // newpost.Content = "NEW"; // newpost.Background = Brushes.Green; //} //else //{ // newpost.Content = ""; // newpost.Background = Brushes.Transparent; //} if (_posts.Count == 1 || _index_of_post == _posts.Count - 1) { btnNext.IsEnabled = false; } if (_postBLL.DidUserLikePost(_userBLL.LoginRead(), _current_post.Id)) { btnLike.BorderBrush = Brushes.YellowGreen; _tempLike = true; } else { btnLike.BorderBrush = Brushes.Transparent; _tempLike = false; } btnLike.Content = "Likes: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString(); } else { Header.Content = "No posts in your friends' Timeline"; Timeline.Content = ""; btnLike.IsEnabled = false; btnComment.IsEnabled = false; btnComments.IsEnabled = false; btnLikers.IsEnabled = false; btnNext.IsEnabled = false; btnPrev.IsEnabled = false; //newpost.Content = ""; //newpost.Background = Brushes.Transparent; } }
public void Refresh() { _posts = _postDAL.SelectAllPosts(_userBLL.GetUserId()); if (_posts != null && _posts.Count > 0) { btnLike.IsEnabled = true; btnComment.IsEnabled = true; btnComments.IsEnabled = true; btnLikers.IsEnabled = true; btnEdit.IsEnabled = true; btnDelete.IsEnabled = true; btnNext.IsEnabled = true; _current_post = _posts[_index_of_post]; Header.Content = "Posts in your Timeline: " + _posts.Count; Timeline.Content = _current_post.Text; date.Content = "Posted on: " + _current_post.DateTime; _is_any_posts = true; if (_posts.Count == 1 || _index_of_post == _posts.Count - 1) { btnNext.IsEnabled = false; } if (_postBLL.DidUserLikePost(_userBLL.LoginRead(), _current_post.Id)) { btnLike.BorderBrush = Brushes.YellowGreen; _tempLike = true; } else { btnLike.BorderBrush = Brushes.Transparent; _tempLike = false; } btnLikers.Content = "View likers: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString(); btnComments.Content = "View comments: " + _postBLL.GetWhoCommented(_current_post.Id).Count; } else { Header.Content = "No posts in your Timeline"; Timeline.Content = ""; date.Content = ""; btnLike.IsEnabled = false; btnComment.IsEnabled = false; btnComments.IsEnabled = false; btnLikers.IsEnabled = false; btnEdit.IsEnabled = false; btnDelete.IsEnabled = false; } }
public void Refresh() { _posts = _postBLL.GetAllPosts(_friendLogin); if (_posts != null && _posts.Count > 0) { btnLike.IsEnabled = true; btnComment.IsEnabled = true; btnComments.IsEnabled = true; btnLikers.IsEnabled = true; btnNext.IsEnabled = true; _current_post = _posts[_index_of_post]; Header.Content = "Posts in " + _user.FirstName + "'s Timeline: " + _posts.Count; Timeline.Content = _current_post.Text; date.Content = "Posted on: " + _current_post.DateTime; _is_any_posts = true; if (_posts.Count == 1 || _index_of_post == _posts.Count - 1) { btnNext.IsEnabled = false; } if (_postBLL.DidUserLikePost(_userBLL.LoginRead(), _current_post.Id)) { btnLike.BorderBrush = Brushes.YellowGreen; _tempLike = true; } else { btnLike.BorderBrush = Brushes.Transparent; _tempLike = false; } btnLike.Content = "Likes: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString(); } else { Header.Content = "No posts in " + _user.FirstName + "'s Timeline"; Timeline.Content = ""; btnLike.IsEnabled = false; btnComment.IsEnabled = false; btnComments.IsEnabled = false; btnLikers.IsEnabled = false; } }
public void Refresh() { _posts = _postBLL.GetAllPosts(_friendLogin); if (_posts != null && _posts.Count > 0) { btnLike.IsEnabled = true; btnComment.IsEnabled = true; btnComments.IsEnabled = true; btnLikers.IsEnabled = true; btnNext.IsEnabled = true; _current_post = _posts[_index_of_post]; Header.Content = "Posts in " + _user.FirstName + "'s Timeline: " + _posts.Count; Timeline.Content = _current_post.Text; date.Content = "Posted on: " + _current_post.DateTime; _is_any_posts = true; if (_posts.Count == 1 || _index_of_post == _posts.Count - 1) { btnNext.IsEnabled = false; } if (_postBLL.DidUserLikePost(_userBLL.LoginRead(), _current_post.Id)) { btnLike.BorderBrush = Brushes.WhiteSmoke; _tempLike = true; } else { btnLike.BorderBrush = Brushes.Transparent; _tempLike = false; } btnLikers.Content = "Liked by: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString(); btnComments.Content = "View comments " + _postBLL.GetWhoCommented(_current_post.Id).Count; } else { Header.Content = "No posts in " + _user.FirstName + "'s Timeline"; Timeline.Content = ""; btnLike.IsEnabled = false; btnComment.IsEnabled = false; btnComments.IsEnabled = false; btnLikers.IsEnabled = false; } _conn = _personBLL.Connections(_userBLL.LoginRead(), _friendLogin); if (_conn == 0) { btnConnections.IsEnabled = false; lblConn.Content = "No connection"; } else if (_conn == 1) { btnConnections.IsEnabled = false; lblConn.Content = "1st connection"; } else if (_conn == 2) { btnConnections.IsEnabled = true; lblConn.Content = "2nd connection"; } else if (_conn == 3) { btnConnections.IsEnabled = false; lblConn.Content = "3rd connection"; } else { btnConnections.IsEnabled = false; lblConn.Content = _conn + "th connection"; } }
public void Refresh() { _followings = _personBLL.GetFollowing(_user.Login); _posts = _postBLL.GetAllPosts(_followings); _new_posts = _postBLL.GetNewPosts(_user.LastLogin, _followings); if (_posts != null && _posts.Count > 0) { btnLike.IsEnabled = true; btnComment.IsEnabled = true; btnComments.IsEnabled = true; btnLikers.IsEnabled = true; btnNext.IsEnabled = true; btnPrev.IsEnabled = false; _is_any_posts = true; _current_post = _posts[_index_of_post]; Header.Content = _userBLL.GetUser(_current_post.OwnerId).Login; Timeline.Content = _current_post.Text; date.Content = "Time: " + _current_post.DateTime; if (_index_of_post < _new_posts.Count) { newpost.Content = "!"; newpost.Background = Brushes.MediumPurple; } else { newpost.Content = ""; newpost.Background = Brushes.Transparent; } if (_posts.Count == 1 || _index_of_post == _posts.Count - 1) { btnNext.IsEnabled = false; } if (_postBLL.DidUserLikePost(_userBLL.LoginRead(), _current_post.Id)) { btnLike.BorderBrush = Brushes.MediumPurple; _tempLike = true; } else { btnLike.BorderBrush = Brushes.Transparent; _tempLike = false; } btnLikers.Content = "Liked by: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString(); btnComments.Content = "View comments " + _postBLL.GetWhoCommented(_current_post.Id).Count; } else { Header.Content = "No posts in your friends' Timeline"; Timeline.Content = ""; btnLike.IsEnabled = false; btnComment.IsEnabled = false; btnComments.IsEnabled = false; btnLikers.IsEnabled = false; btnNext.IsEnabled = false; btnPrev.IsEnabled = false; newpost.Content = ""; newpost.Background = Brushes.Transparent; } }