コード例 #1
0
        public async Task <VkDocumentAttachment> Save(string file, string title = null, string tags = null)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("file", file);

            if (!string.IsNullOrEmpty(title))
            {
                parameters.Add("title", title);
            }

            if (!string.IsNullOrEmpty(tags))
            {
                parameters.Add("tags", tags);
            }

            _vk.SignMethod(parameters);

            var response = await VkRequest.GetAsync(VkConst.MethodBase + "docs.save", parameters);

            if (response["response"] != null)
            {
                return(VkDocumentAttachment.FromJson(response["response"].First));
            }

            return(null);
        }
コード例 #2
0
        public MessageDocumentControl(VkDocumentAttachment document)
        {
            this.Document = document;

            this.InitializeComponent();

            if (!string.IsNullOrEmpty(document.Photo130))
            {
                ContentControl.ContentTemplate = (DataTemplate)Resources["ImageDocumentTemplate"];
            }
            else
            {
                ContentControl.ContentTemplate = (DataTemplate)Resources["GenericDocumentTemplate"];
            }
        }