Ejemplo n.º 1
0
        public void EditComment(WallPostRequestData data, Action <BackendResult <long, ResultCode> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["owner_id"]   = data.owner_id.ToString();
            parameters["comment_id"] = data.comment_id.ToString();
            parameters["message"]    = data.message;
            if (!data.AttachmentIds.IsNullOrEmpty())
            {
                parameters["attachments"] = data.AttachmentIds.GetCommaSeparated(",");
            }
            VKRequestsDispatcher.DispatchRequestToVK <long>("wall.editComment", parameters, callback, null, false, true, new CancellationToken?(), null);
        }
Ejemplo n.º 2
0
        public void Edit(WallPostRequestData postData, Action <BackendResult <ResponseWithId, ResultCode> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            long num;

            if (postData.owner_id != 0L)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "owner_id";
                num = postData.owner_id;
                string str = num.ToString();
                dictionary[index] = str;
            }
            Dictionary <string, string> dictionary1 = parameters;
            string index1 = "post_id";

            num = postData.post_id;
            string str1 = num.ToString();

            dictionary1[index1] = str1;
            if (!string.IsNullOrEmpty(postData.message))
            {
                parameters["message"] = postData.message ?? "";
            }
            parameters["signed"] = postData.Sign ? "1" : "0";
            if (!postData.AttachmentIds.IsNullOrEmpty())
            {
                parameters["attachments"] = postData.AttachmentIds.GetCommaSeparated(",");
            }
            double?nullable;

            if (postData.latitude.HasValue)
            {
                Dictionary <string, string> dictionary2 = parameters;
                string index2 = "lat";
                nullable = postData.latitude;
                string str2 = nullable.Value.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary2[index2] = str2;
            }
            nullable = postData.longitude;
            if (nullable.HasValue)
            {
                Dictionary <string, string> dictionary2 = parameters;
                string index2 = "long";
                nullable = postData.longitude;
                string str2 = nullable.Value.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary2[index2] = str2;
            }
            if (postData.publish_date.HasValue)
            {
                Dictionary <string, string> dictionary2 = parameters;
                string index2 = "publish_date";
                num = postData.publish_date.Value;
                string str2 = num.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary2[index2] = str2;
            }
            VKRequestsDispatcher.DispatchRequestToVK <ResponseWithId>("wall.edit", parameters, callback, (Func <string, ResponseWithId>)(jsonStr => new ResponseWithId()
            {
                response = 1L
            }), false, true, new CancellationToken?(), null);
        }
Ejemplo n.º 3
0
        public void Post(WallPostRequestData postData, Action <BackendResult <ResponseWithId, ResultCode> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            long num;

            if (postData.owner_id != 0L)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "owner_id";
                num = postData.owner_id;
                string str = num.ToString();
                dictionary[index] = str;
            }
            if (!string.IsNullOrEmpty(postData.message))
            {
                parameters["message"] = postData.message ?? "";
            }
            if (!postData.AttachmentIds.IsNullOrEmpty())
            {
                parameters["attachments"] = postData.AttachmentIds.GetCommaSeparated(",");
            }
            double?nullable;

            if (postData.latitude.HasValue)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "lat";
                nullable = postData.latitude;
                string str = nullable.Value.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary[index] = str;
            }
            nullable = postData.longitude;
            if (nullable.HasValue)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "long";
                nullable = postData.longitude;
                string str = nullable.Value.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary[index] = str;
            }
            if (postData.publish_date.HasValue)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "publish_date";
                num = postData.publish_date.Value;
                string str = num.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                dictionary[index] = str;
            }
            if (postData.PublishOnTwitter)
            {
                parameters["services"] = "twitter";
            }
            if (postData.PublishOnFacebook)
            {
                parameters["services"] = !postData.PublishOnTwitter ? "facebook" : "twitter,facebook";
            }
            if (postData.post_id != 0L)
            {
                Dictionary <string, string> dictionary = parameters;
                string index = "post_id";
                num = postData.post_id;
                string str = num.ToString();
                dictionary[index] = str;
            }
            parameters["from_group"] = postData.OnBehalfOfGroup || postData.Sign ? "1" : "0";
            parameters["signed"]     = postData.Sign ? "1" : "0";
            if (postData.FriendsOnly)
            {
                parameters["friends_only"] = "1";
            }
            VKRequestsDispatcher.DispatchRequestToVK <ResponseWithId>("wall.post", parameters, callback, (Func <string, ResponseWithId>)(jsonStr =>
            {
                WallService.ResponseWithPostId responseWithPostId = JsonConvert.DeserializeObject <WallService.ResponseWithPostId>(jsonStr);
                return(new ResponseWithId()
                {
                    response = responseWithPostId.response.post_id
                });
            }), false, true, new CancellationToken?(), null);
        }