示例#1
0
        public long Delete(LikeObjectType type, long itemId, long? ownerId = null)
        {
            var parameters = new VkParameters
                {
                    { "type", type },
                    { "item_id", itemId },
                    { "owner_id", ownerId }
                };

            var response = _vk.Call("likes.delete", parameters);

            return response["likes"];
        }
示例#2
0
        public long Delete(LikeObjectType type, long itemId, long? ownerId = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);

            var parameters = new VkParameters
                {
                    {"type", type},
                    {"item_id", itemId},
                    {"owner_id", ownerId}
                };

            VkResponse response = _vk.Call("likes.delete", parameters);

            return response["likes"];
        }
示例#3
0
		public long Add(LikeObjectType type, long itemId, long? ownerId = null, string accessKey = null, string reference = null)
		{
			var parameters = new VkParameters
				{
					{ "type", type },
					{ "item_id", itemId },
					{ "owner_id", ownerId },
					{ "access_key", accessKey },
					{ "ref", reference }
				};

			var response = _vk.Call("likes.add", parameters);

			return response["likes"];
		}
示例#4
0
        public bool IsLiked(out bool copied, LikeObjectType type, long itemId, long?userId = null, long?ownerId = null)
        {
            var parameters = new VkParameters
            {
                { "type", type },
                { "item_id", itemId },
                { "user_id", userId },
                { "owner_id", ownerId }
            };

            var resp = _vk.Call("likes.isLiked", parameters);

            copied = resp["copied"];
            return(resp["liked"]);
        }
示例#5
0
        public long Add(LikeObjectType type, long itemId, long?ownerId = null, string accessKey = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);

            var parameters = new VkParameters
            {
                { "type", type },
                { "item_id", itemId },
                { "owner_id", ownerId },
                { "access_key", accessKey }
            };

            VkResponse response = _vk.Call("likes.add", parameters);

            return(response["likes"]);
        }
示例#6
0
 public LikesViewModel(long ownerId, long itemId, LikeObjectType type, int knownCount)
 {
     this._ownerId             = ownerId;
     this._itemId              = itemId;
     this._type                = type;
     this._allCount            = knownCount;
     this._all                 = new GenericCollectionViewModel <LikesList, FriendHeader>((ICollectionDataProvider <LikesList, FriendHeader>) this);
     this._all.LoadCount       = 60;
     this._all.ReloadCount     = 100;
     this._friends             = new GenericCollectionViewModel <LikesList, FriendHeader>((ICollectionDataProvider <LikesList, FriendHeader>) this);
     this._friends.LoadCount   = 60;
     this._friends.ReloadCount = 100;
     this._shared              = new GenericCollectionViewModel <LikesList, FriendHeader>((ICollectionDataProvider <LikesList, FriendHeader>) this);
     this._shared.LoadCount    = 60;
     this._shared.ReloadCount  = 100;
 }
        public ReadOnlyCollection <> Add(LikeObjectType type, long itemId, long?ownerId = null, string accessKey = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);

            var parameters = new VkParameters
            {
                { "type", type },
                { "item_id", itemId },
                { "owner_id", ownerId },
                { "access_key", accessKey }
            };

            VkResponseArray response = _vk.Call("likes.add", parameters);

            return(response.ToReadOnlyCollectionOf <>(x => x));
        }
示例#8
0
        public long Add(LikeObjectType type, long itemId, long? ownerId = null, string accessKey = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);

            var parameters = new VkParameters
                {
                    {"type", type},
                    {"item_id", itemId},
                    {"owner_id", ownerId},
                    {"access_key", accessKey}
                };

            VkResponse response = _vk.Call("likes.add", parameters);

            return response["likes"];
        }
示例#9
0
        public bool IsLiked(LikeObjectType type, long itemId, out bool copied, long?userId = null, long?ownerId = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);
            VkErrors.ThrowIfNumberIsNegative(() => userId);

            var parameters = new VkParameters
            {
                { "type", type },
                { "item_id", itemId },
                { "user_id", userId },
                { "owner_id", ownerId }
            };

            var resp = _vk.Call("likes.isLiked", parameters);

            copied = resp["copied"];
            return(resp["liked"]);
        }
示例#10
0
        public void LikeObjectTypeTest()
        {
            // get test
            Assert.That(actual: LikeObjectType.Post.ToString(), expression: Is.EqualTo(expected: "post"));
            Assert.That(actual: LikeObjectType.Comment.ToString(), expression: Is.EqualTo(expected: "comment"));
            Assert.That(actual: LikeObjectType.Photo.ToString(), expression: Is.EqualTo(expected: "photo"));
            Assert.That(actual: LikeObjectType.Audio.ToString(), expression: Is.EqualTo(expected: "audio"));
            Assert.That(actual: LikeObjectType.Video.ToString(), expression: Is.EqualTo(expected: "video"));
            Assert.That(actual: LikeObjectType.Note.ToString(), expression: Is.EqualTo(expected: "note"));
            Assert.That(actual: LikeObjectType.PhotoComment.ToString(), expression: Is.EqualTo(expected: "photo_comment"));
            Assert.That(actual: LikeObjectType.VideoComment.ToString(), expression: Is.EqualTo(expected: "video_comment"));
            Assert.That(actual: LikeObjectType.TopicComment.ToString(), expression: Is.EqualTo(expected: "topic_comment"));
            Assert.That(actual: LikeObjectType.SitePage.ToString(), expression: Is.EqualTo(expected: "sitepage"));
            Assert.That(actual: LikeObjectType.Market.ToString(), expression: Is.EqualTo(expected: "market"));
            Assert.That(actual: LikeObjectType.MarketComment.ToString(), expression: Is.EqualTo(expected: "market_comment"));

            // parse test
            Assert.That(actual: LikeObjectType.FromJsonString(response: "post"), expression: Is.EqualTo(expected: LikeObjectType.Post));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "comment")
                        , expression: Is.EqualTo(expected: LikeObjectType.Comment));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "photo"), expression: Is.EqualTo(expected: LikeObjectType.Photo));
            Assert.That(actual: LikeObjectType.FromJsonString(response: "audio"), expression: Is.EqualTo(expected: LikeObjectType.Audio));
            Assert.That(actual: LikeObjectType.FromJsonString(response: "video"), expression: Is.EqualTo(expected: LikeObjectType.Video));
            Assert.That(actual: LikeObjectType.FromJsonString(response: "note"), expression: Is.EqualTo(expected: LikeObjectType.Note));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "photo_comment")
                        , expression: Is.EqualTo(expected: LikeObjectType.PhotoComment));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "video_comment")
                        , expression: Is.EqualTo(expected: LikeObjectType.VideoComment));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "topic_comment")
                        , expression: Is.EqualTo(expected: LikeObjectType.TopicComment));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "sitepage")
                        , expression: Is.EqualTo(expected: LikeObjectType.SitePage));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "market"), expression: Is.EqualTo(expected: LikeObjectType.Market));

            Assert.That(actual: LikeObjectType.FromJsonString(response: "market_comment")
                        , expression: Is.EqualTo(expected: LikeObjectType.MarketComment));
        }
示例#11
0
        public void LikeObjectTypeTest()
        {
            // get test
            Assert.That(LikeObjectType.Post.ToString(), Is.EqualTo("post"));
            Assert.That(LikeObjectType.Comment.ToString(), Is.EqualTo("comment"));
            Assert.That(LikeObjectType.Photo.ToString(), Is.EqualTo("photo"));
            Assert.That(LikeObjectType.Audio.ToString(), Is.EqualTo("audio"));
            Assert.That(LikeObjectType.Video.ToString(), Is.EqualTo("video"));
            Assert.That(LikeObjectType.Note.ToString(), Is.EqualTo("note"));
            Assert.That(LikeObjectType.PhotoComment.ToString(), Is.EqualTo("photo_comment"));
            Assert.That(LikeObjectType.VideoComment.ToString(), Is.EqualTo("video_comment"));
            Assert.That(LikeObjectType.TopicComment.ToString(), Is.EqualTo("topic_comment"));
            Assert.That(LikeObjectType.SitePage.ToString(), Is.EqualTo("sitepage"));
            Assert.That(LikeObjectType.Market.ToString(), Is.EqualTo("market"));
            Assert.That(LikeObjectType.MarketComment.ToString(), Is.EqualTo("market_comment"));

            // parse test
            Assert.That(LikeObjectType.FromJsonString("post"), Is.EqualTo(LikeObjectType.Post));

            Assert.That(LikeObjectType.FromJsonString("comment")
                        , Is.EqualTo(LikeObjectType.Comment));

            Assert.That(LikeObjectType.FromJsonString("photo"), Is.EqualTo(LikeObjectType.Photo));
            Assert.That(LikeObjectType.FromJsonString("audio"), Is.EqualTo(LikeObjectType.Audio));
            Assert.That(LikeObjectType.FromJsonString("video"), Is.EqualTo(LikeObjectType.Video));
            Assert.That(LikeObjectType.FromJsonString("note"), Is.EqualTo(LikeObjectType.Note));

            Assert.That(LikeObjectType.FromJsonString("photo_comment")
                        , Is.EqualTo(LikeObjectType.PhotoComment));

            Assert.That(LikeObjectType.FromJsonString("video_comment")
                        , Is.EqualTo(LikeObjectType.VideoComment));

            Assert.That(LikeObjectType.FromJsonString("topic_comment")
                        , Is.EqualTo(LikeObjectType.TopicComment));

            Assert.That(LikeObjectType.FromJsonString("sitepage")
                        , Is.EqualTo(LikeObjectType.SitePage));

            Assert.That(LikeObjectType.FromJsonString("market"), Is.EqualTo(LikeObjectType.Market));

            Assert.That(LikeObjectType.FromJsonString("market_comment")
                        , Is.EqualTo(LikeObjectType.MarketComment));
        }
示例#12
0
        public CommentItem(double width, Thickness margin, LikeObjectType likeObjectType, Action <CommentItem> deleteCommentCallback, Action <CommentItem> replyCommentCallback, Action <CommentItem> editCommentCallback, long owner_id, Comment comment, User user, User user2, Group group, Action <CommentItem> tapCommentCallback = null, string extraText = "", string thumbSrc = "", Action <CommentItem> seeAllLikesCallback = null, bool preview = false, bool isNotificationComment = false, string hightlightedText = "")
            : base(width, margin, new Thickness())
        {
            this._preview               = preview;
            this._extraText             = extraText;
            this._thumbSrc              = thumbSrc;
            this._deleteCommentCallback = deleteCommentCallback;
            this._replyCommentCallback  = replyCommentCallback;
            this._editCommentCallback   = editCommentCallback;
            this._tapCommentCallback    = tapCommentCallback;
            this._seeAllLikesCallback   = seeAllLikesCallback;
            this._likeObjectType        = likeObjectType;
            this._comment               = comment;
            this._user  = user;
            this._user2 = user2;
            this._group = group;
            if (this._group == null && this._comment.from_id < 0L)
            {
                this._group = GroupsService.Current.GetCachedGroup(-this._comment.from_id);
            }
            this._highlightedText = hightlightedText;
            Border border = new Border();
            double num1   = 18.0;

            border.Width = num1;
            double num2 = 18.0;

            border.Height               = num2;
            this._imageLike             = border;
            this._owner_id              = owner_id;
            this._isNotificationComment = isNotificationComment;
            int         num3        = (int)(Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];
            BitmapImage bitmapImage = new BitmapImage(new Uri("/VKClient.Common;component/Resources/like-white.png", UriKind.Relative));

            this._imageLike.OpacityMask = (Brush) new ImageBrush()
            {
                ImageSource = (ImageSource)bitmapImage
            };
            this._textBlockLike = new TextBlock();
            this.CreateVirtualizableChildren();
            this.UpdateLikeImageAndTextBlock();
            this.HookupTapEvent();
            EventAggregator.Current.Subscribe((object)this);
        }
示例#13
0
        internal static void ReportComment(long fromId, long id, LikeObjectType likeObjectType)
        {
            PickerUC.ShowPickerFor(ReportContentHelper.GetPredefinedReportReasons(), (PickableItem)null, (Action <PickableItem>)(pi =>
            {
                switch (likeObjectType)
                {
                case LikeObjectType.comment:
                    WallService.Current.ReportComment(fromId, id, (ReportReason)pi.ID, (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(res => GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.ReportSent, (VKRequestsDispatcher.Error)null)));
                    break;

                case LikeObjectType.photo_comment:
                    PhotosService.Current.ReportComment(fromId, id, (ReportReason)pi.ID, (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(res => GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.ReportSent, (VKRequestsDispatcher.Error)null)));
                    break;

                case LikeObjectType.video_comment:
                    VideoService.Instance.ReportComment(fromId, id, (ReportReason)pi.ID, (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(res => GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.ReportSent, (VKRequestsDispatcher.Error)null)));
                    break;
                }
            }), (Action <PickableItem>)null, null, CommonResources.CommentContains);
        }
示例#14
0
        public ReadOnlyCollection<> GetList(LikeObjectType type, long? ownerId = null, long? itemId = null, string pageUrl = null, string filter = null, bool? friendsOnly = null, bool? extended = null, long? offset = null, int? count = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => offset);
            VkErrors.ThrowIfNumberIsNegative(() => count);

            var parameters = new VkParameters
                {
                    {"type", type},
                    {"owner_id", ownerId},
                    {"item_id", itemId},
                    {"page_url", pageUrl},
                    {"filter", filter},
                    {"friends_only", friendsOnly},
                    {"extended", extended},
                    {"offset", offset},
                    {"count", count}
                };

            VkResponseArray response = _vk.Call("likes.getList", parameters);

            return response.ToReadOnlyCollectionOf<>(x => x);
        }
示例#15
0
文件: LikesCategory.cs 项目: ddal/vk
        public ReadOnlyCollection <User> GetList(LikeObjectType type, long?ownerId = null, long?itemId = null, string pageUrl = null, string filter = null, bool?friendsOnly = null, bool?extended = null, long?offset = null, int?count = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => offset);
            VkErrors.ThrowIfNumberIsNegative(() => count);

            var parameters = new VkParameters
            {
                { "type", type },
                { "owner_id", ownerId },
                { "item_id", itemId },
                { "page_url", pageUrl },
                { "filter", filter },
                { "friends_only", friendsOnly },
                { "extended", extended },
                { "offset", offset },
                { "count", count }
            };

            VkResponseArray response = _vk.Call("likes.getList", parameters);

            return(response.ToReadOnlyCollectionOf <User>(x => x));
        }
 /// <inheritdoc />
 public Task <bool> IsLikedAsync(LikeObjectType type, long itemId, long?userId = null, long?ownerId = null)
 {
     return(TypeHelper.TryInvokeMethodAsync(func: () =>
                                            IsLiked(copied: out var _, type: type, itemId: itemId, userId: userId, ownerId: ownerId)));
 }
示例#17
0
 /// <inheritdoc />
 public async Task <bool> IsLikedAsync(LikeObjectType type, long itemId, long?userId = null, long?ownerId = null)
 {
     return(await TypeHelper.TryInvokeMethodAsync(() => _vk.Likes.IsLiked(out var copied, type, itemId, userId, ownerId)));
 }
 public static CommentItem CreateCommentItem(double width, Comment comment, LikeObjectType likeObjType, long ownerId, User user, User user2, Group group, Action <CommentItem> deleteCallback, Action <CommentItem> replyCallback, Action <CommentItem> editCallback, Action <CommentItem> tapCallback = null)
 {
     return(new CommentItem(width - 32.0, new Thickness(8.0, 0.0, 0.0, CommentsItemsGeneratorHelper.MarginBetweenComments), likeObjType, deleteCallback, replyCallback, editCallback, ownerId, comment, user, user2, group, (Action <CommentItem>)null, "", "", (Action <CommentItem>)null, false, false, ""));
 }
示例#19
0
 /// <inheritdoc />
 public async Task <long> DeleteAsync(LikeObjectType type, long itemId, long?ownerId = null, long?captchaSid = null,
                                      string captchaKey = null)
 {
     return(await TypeHelper.TryInvokeMethodAsync(() => _vk.Likes.Delete(type, itemId, ownerId, captchaSid, captchaKey)));
 }
示例#20
0
        public void GetWallPostByIdWithComments(long postId, long ownerId, int offset, int countToRead, int knownTotalCount, bool needWallPost, Action <BackendResult <GetWallPostResponseData, ResultCode> > callback, long pollId = 0, long pollOwnerId = 0, LikeObjectType likeObjType = LikeObjectType.post)
        {
            long userId = VKRequestsDispatcher.AuthData.user_id;

            if (knownTotalCount != -1 && offset + countToRead > knownTotalCount)
            {
                countToRead = knownTotalCount - offset;
            }
            string str1 = (!needWallPost ? "var likesAll = API.likes.getList({{\"item_id\":{0}, \"owner_id\":{1}, \"count\":20, type:\"{8}\"}});" : " var wallPost = API.wall.getById({{\"posts\":\"{1}_{0}\"}});\r\nvar likesAll = API.likes.getList({{\"item_id\":{0}, \"owner_id\":{1}, \"count\":20, type:wallPost[0].post_type}});" + Environment.NewLine) + "\r\n\r\n\r\n\r\nvar offset = {2};\r\n\r\n\r\nvar comments = API.wall.getComments({{\"post_id\":\"{0}\", \"owner_id\":\"{1}\", \"offset\":offset, \"count\":\"{3}\", \"need_likes\":\"1\", \"sort\":\"desc\", \"preview_length\":\"0\", \"allow_group_comments\":1}});\r\n\r\nvar datUsersNames = [email protected]_to_user + [email protected]_id;\r\nvar users2 = API.users.get({{\"user_ids\":datUsersNames, \"fields\":\"first_name_dat,last_name_dat\"}});\r\n\r\n\r\n\r\nvar userOrGroupIds = likesAll.items;\r\n";

            if (needWallPost)
            {
                str1 += "userOrGroupIds = userOrGroupIds + [email protected]_id + [email protected]_id + [email protected]_id + wallPost[0][email protected]_id + wallPost[0][email protected]_id;\r\n";
            }
            string str2 = str1 + "userOrGroupIds = userOrGroupIds + [email protected]_id;\r\n\r\n\r\nvar userIds = [];\r\nvar groupIds = [];\r\n\r\nvar i = 0;\r\n\r\nvar length = userOrGroupIds.length;\r\n\r\nwhile (i < length)\r\n{{\r\n    var id = parseInt(userOrGroupIds[i]);\r\n    \r\n    if (id > 0)\r\n    {{\r\n       if (userIds.length > 0)\r\n       {{\r\n          userIds = userIds + \",\";\r\n       }}\r\n       userIds = userIds + id;\r\n    }}\r\n    else if (id < 0)\r\n    {{\r\n        id = -id;\r\n        if (groupIds.length > 0)\r\n        {{\r\n            groupIds = groupIds + \",\";\r\n        }}\r\n        groupIds = groupIds + id;\r\n    }}\r\n     \r\n    i = i + 1;\r\n}}\r\n\r\nif ({1} < 0)\r\n{{\r\n    if (groupIds.length > 0) groupIds = groupIds + \",\";\r\n    groupIds = groupIds + ({1} * -1);\r\n}}\r\n\r\nvar users  = API.users.get({{\"user_ids\":userIds, \"fields\":\"sex,photo_max,online,online_mobile\" }});\r\nvar groups = API.groups.getById({{\"group_ids\":groupIds}});";
            string str3 = string.Format(pollId == 0L ? (!needWallPost ? str2 + "return {{\"Users\": users, \"Groups\":groups, \"LikesAll\":likesAll, \"comments\": comments, \"Users2\": users2 }};" : str2 + "return {{\"Users\": users, \"Groups\":groups, \"LikesAll\":likesAll, \"WallPost\":wallPost[0], \"comments\": comments, \"Users2\": users2 }};") : (!needWallPost ? str2 + "\r\nvar poll= API.polls.getById({{\"owner_id\":{7}, \"poll_id\":{6}}});   \r\nreturn {{\"Users\": users, \"Groups\":groups, \"LikesAll\":likesAll, \"comments\": comments, \"Users2\": users2, \"Poll\":poll }};" : str2 + "\r\nvar poll= API.polls.getById({{\"owner_id\":{7}, \"poll_id\":{6}}});   \r\nreturn {{\"Users\": users, \"Groups\":groups, \"LikesAll\":likesAll, \"WallPost\":wallPost[0], \"comments\": comments, \"Users2\": users2, \"Poll\":poll }};"), postId, ownerId, offset, countToRead, knownTotalCount, userId, pollId, pollOwnerId, likeObjType);
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["code"] = str3;
            VKRequestsDispatcher.DispatchRequestToVK <GetWallPostResponseData>("execute", parameters, callback, (Func <string, GetWallPostResponseData>)(jsonStr =>
            {
                VKRequestsDispatcher.GenericRoot <GetWallPostResponseData> genericRoot = JsonConvert.DeserializeObject <VKRequestsDispatcher.GenericRoot <GetWallPostResponseData> >(VKRequestsDispatcher.FixFalseArray(VKRequestsDispatcher.FixFalseArray(VKRequestsDispatcher.FixFalseArray(VKRequestsDispatcher.FixFalseArray(VKRequestsDispatcher.FixFalseArray(VKRequestsDispatcher.FixFalseArray(jsonStr, "Users", false), "Users2", false), "Groups", false), "Poll", true), "LikesAll", true), "comments", true));
                if (genericRoot.response.LikesAll.items != null)
                {
                    genericRoot.response.LikesAll.users = new List <UserLike>(genericRoot.response.LikesAll.items.Select <long, UserLike>((Func <long, UserLike>)(it => new UserLike()
                    {
                        uid = it
                    })));
                }
                genericRoot.response.Users.Add(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                genericRoot.response.Comments.Reverse();
                GroupsService.Current.AddCachedGroups((IEnumerable <Group>)genericRoot.response.Groups);
                if (countToRead == 0)
                {
                    genericRoot.response.Comments.Clear();
                }
                if (genericRoot.response.WallPost == null)
                {
                    genericRoot.response.WallPost = new WallPost();
                }
                return(genericRoot.response);
            }), false, true, new CancellationToken?(), null);
        }
示例#21
0
        public ReadOnlyCollection<> Add(LikeObjectType type, long itemId, long? ownerId = null, string accessKey = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);

            var parameters = new VkParameters
                {
                    {"type", type},
                    {"item_id", itemId},
                    {"owner_id", ownerId},
                    {"access_key", accessKey}
                };

            VkResponseArray response = _vk.Call("likes.add", parameters);

            return response.ToReadOnlyCollectionOf<>(x => x);
        }
示例#22
0
        public bool IsLiked(LikeObjectType type, long itemId, out bool copied, long? userId = null, long? ownerId = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => itemId);
            VkErrors.ThrowIfNumberIsNegative(() => userId);

            var parameters = new VkParameters
                {
                    {"type", type},
                    {"item_id", itemId},
                    {"user_id", userId},
                    {"owner_id", ownerId}
                };

            var resp = _vk.Call("likes.isLiked", parameters);

            copied = resp["copied"];
            return resp["liked"];
        }
示例#23
0
		public bool IsLiked(out bool copied, LikeObjectType type, long itemId,  long? userId = null, long? ownerId = null)
		{
			var parameters = new VkParameters
				{
					{ "type", type },
					{ "item_id", itemId },
					{ "user_id", userId },
					{ "owner_id", ownerId }
				};

			var resp = _vk.Call("likes.isLiked", parameters);

			copied = resp["copied"];
			return resp["liked"];
		}
        private void LoadMoreCommentsInBuffer(Action <bool> completionCallback)
        {
            int            countToRead  = this._commentsCount != -1 ? this._countToReload : this._countToLoad;
            bool           needWallPost = this._wallPostData == null;
            LikeObjectType likeObjType  = LikeObjectType.post;

            if (this._wallPostData != null && this._wallPostData.WallPost != null)
            {
                likeObjType = this._wallPostData.WallPost.GetLikeObjectType();
            }
            if (needWallPost || !this.IsWallPostAddedToUI)
            {
                this.SetInProgress(true, CommonResources.Loading);
            }
            WallService.Current.GetWallPostByIdWithComments(this._postId, this._ownerId, this._fetchedComments.Count, countToRead, this._commentsCount, needWallPost, (Action <BackendResult <GetWallPostResponseData, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                this.SetInProgress(false, "");
                if (res.ResultCode != ResultCode.Succeeded)
                {
                    completionCallback(false);
                }
                else
                {
                    if (this._commentsCount == -1)
                    {
                        EventAggregator.Current.Publish((object)new WallCommentsLikesUpdated()
                        {
                            OwnerId = this._ownerId,
                            WallPostId = this._postId,
                            CommentsCount = res.ResultData.Count,
                            LikesCount = res.ResultData.LikesAll.count
                        });
                        this._commentsCount = res.ResultData.Count;
                        this._runningCountOfComments = this._commentsCount;
                    }
                    this._user1List.AddRange((IEnumerable <User>)res.ResultData.Users);
                    this._user2List.AddRange((IEnumerable <User>)res.ResultData.Users2);
                    if (AppGlobalStateManager.Current.GlobalState.LoggedInUser != null)
                    {
                        this._user1List.Add(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                        this._user2List.Add(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                    }
                    this._groupsList.AddRange((IEnumerable <Group>)res.ResultData.Groups);
                    List <Comment> commentList = this._fetchedComments;
                    this._fetchedComments = res.ResultData.Comments;
                    foreach (Comment comment1 in commentList)
                    {
                        Comment comment = comment1;
                        if (!this._fetchedComments.Any <Comment>((Func <Comment, bool>)(c => c.cid == comment.cid)))
                        {
                            this._fetchedComments.Add(comment);
                        }
                    }
                    this._wallResponseData = res.ResultData;
                    if (this._wallResponseData.WallPost.to_id == 0L && this._wallPostData != null)
                    {
                        this._wallResponseData.WallPost = this._wallPostData.WallPost;
                    }
                    completionCallback(true);
                    if (!this._wallPostData.WallPost.IsNotExist)
                    {
                        return;
                    }
                    int num = (int)MessageBox.Show(CommonResources.WallPostIsNotAvailable, CommonResources.Error, MessageBoxButton.OK);
                    Navigator.Current.GoBack();
                }
            }))), this.PollId, this.PollOwnerId, likeObjType);
        }