public static VKAttachment Deserialize(object attachment)
        {
            var    data = (Dictionary <string, object>)attachment;
            var    _atachment = new VKAttachment();
            object type, audio, photo, poll, doc, link, wall, note, Page;

            if (data.TryGetValue("type", out type))
            {
                _atachment.type = (string)type;
            }
            if (data.TryGetValue("audio", out audio))
            {
                _atachment.audio = VKAudio.Deserialize(audio);
            }
            if (data.TryGetValue("photo", out photo))
            {
                _atachment.photo = VKPhoto.Deserialize(photo);
            }
            if (data.TryGetValue("poll", out poll))
            {
                _atachment.poll = VKPoll.Deserialize(poll);
            }
            if (data.TryGetValue("doc", out doc))
            {
                _atachment.doc = VKDocument.Deserialize(doc);
            }
            if (data.TryGetValue("link", out link))
            {
                _atachment.link = VKLink.Deserialize(link);
            }
            if (data.TryGetValue("wall", out wall))
            {
                _atachment.wall = VKWallPost.Deserialize(wall);
            }
            if (data.TryGetValue("note", out note))
            {
                _atachment.note = VKNote.Deserialize(note);
            }
            if (data.TryGetValue("Page", out Page))
            {
                _atachment.Page = VKPage.Deserialize(Page);
            }
            return(_atachment);
        }
Exemplo n.º 2
0
        void OnPhotoSaved(VKRequest arg1)
        {
            if (arg1.error != null)
            {
                _callbackFunction(arg1);
                return;
            }

            var dict  = Json.Deserialize(arg1.response) as Dictionary <string, object>;
            var resp  = (List <object>)dict["response"];
            var photo = VKPhoto.Deserialize(resp [0]);

            _photoIds.Add(photo.id);
            _imagesToUpload--;
            if (_imagesToUpload == 0)
            {
                PostToWall(RepeatRequest);
            }
        }