Beispiel #1
0
        public void Set(VK.PageStatus status)
#endif
        {
            // Check
            HostSession.EnsureHasPermission(VK.SecurityFlag.Statuses);

            // Request
            var args = new NameValueCollection();
            //args.Add("id", page.ToString());
            status.APIDigest(args);
#if NEWSTYLE
            XmlElement response = await HostSession.Network.AsyncXmlMethodCall("status.set", args);
#else
            XmlElement response = HostSession.Network.XmlMethodCall("status.set", args);
#endif

            // Check
            int opResult = -1;
            if (response == null || string.IsNullOrEmpty(response.InnerText) || response.NodeType != XmlNodeType.Element
                || !int.TryParse(response.InnerText, out opResult))
                throw new VK.APIImplException(HostSession, "status.set", "Unexpected server reply.");

            // Check opResult
            if (opResult != 1)
                throw new VK.APIImplException(HostSession, "status.set", "Status set failed, return code: " + opResult + '.');
        }