예제 #1
0
        internal bool RemoveComment(Comment comment)
        {
            bool removed = observableData.Remove(comment);
            if (removed == false) return false;

            if(count > 0)
                count--;
            return true;
        }
        private async void HandleDelete(Comment comment)
        {
            bool deleteSuccess = await _viewModel.DeleteComment(comment.id);

            if (deleteSuccess != false) return;

            CommentError.Visibility = Visibility.Visible;
            _timer.Tick += (o, e) => { CommentError.Visibility = Visibility.Collapsed; };
            _timer.Tick += (o, e) => _timer.Stop();
            _timer.Interval = new TimeSpan(0, 0, 5);
            _timer.Start();
        }
예제 #3
0
 internal bool AddComment(Comment comment)
 {
     observableData.Add(comment);
     count++;
     return true;
 }
        internal async Task<bool> DeleteComment(string commentId)
        {
            bool success = await Instagram.DeleteComment(CurrentMedia.id, commentId);

            if (success)
            {
                Media relatedMediaItem = null;
                int index = RelatedMedia.IndexOf(CurrentMedia);
                if (index > -1)
                    relatedMediaItem = RelatedMedia.ElementAt(index);

                Comment tmpComment = new Comment {id = commentId};
                CurrentMedia.comments.RemoveComment(tmpComment);
                if (relatedMediaItem != null) relatedMediaItem.comments.RemoveComment(tmpComment);
            }
            return success;
        }