Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (textBox2.Text != "" && comboBox2.Text != "")
            {
                button1.Enabled = true;
            }
            string    request123 = "https://api.vk.com/method/wall.get?owner_id=" + textBox2.Text + "&access_token=" + Form1.access_token + "&v=5.92 ";
            WebClient wct        = new WebClient();
            string    answer123  = Encoding.UTF8.GetString(wct.DownloadData(request123));
            like      lis        = JsonConvert.DeserializeObject <like>(answer123);

            postt gr;

            gr = JsonConvert.DeserializeObject <postt>(answer123);

            string    request321 = "https://api.vk.com/method/wall.get?owner_id=" + textBox2.Text + "&access_token=" + Form1.access_token + "&v=5.92";
            WebClient wc         = new WebClient();
            string    answer312  = Encoding.UTF8.GetString(wc.DownloadData(request321));
            like      lik        = JsonConvert.DeserializeObject <like>(answer312);

            for (int itemIndex = 0; itemIndex < gr.response.items.Length; itemIndex = itemIndex + 1)
            {
                string[] names = new string[3];
                names[0] = gr.response.items[itemIndex].text;
                names[2] = gr.response.items[itemIndex].id.ToString();
                comboBox2.Items.Add(gr.response.items[itemIndex].id);
                label14.Text = gr.response.items[itemIndex].text;
            }
        }
Example #2
0
        private void Post_Load(object sender, EventArgs e)
        {
            try
            {
                string request2 = "https://api.vk.com/method/likes.add?type=post&owner_id=-" + group_id + "&item_id=41758&access_token=" + Form1.access_token + "&v=5.92";


                WebClient client = new WebClient();

                string answer = Encoding.UTF8.GetString(client.DownloadData(request2));//
                like   li     = JsonConvert.DeserializeObject <like>(answer);
                postt  po;
                po = JsonConvert.DeserializeObject <postt>(answer);
            }
            catch (Exception ex)
            {
            }


            string request4 = "https://api.vk.com/method/wall.get?owner_id=-" + group_id + "&access_token=" + Form1.access_token + "&v=5.92 ";

            WebClient wct     = new WebClient();
            string    answer3 = Encoding.UTF8.GetString(wct.DownloadData(request4));
            like      lis     = JsonConvert.DeserializeObject <like>(answer3);

            postt gr;

            gr = JsonConvert.DeserializeObject <postt>(answer3);


            string request3 = "https://api.vk.com/method/wall.get?owner_id=-" + group_id + "&access_token=" + Form1.access_token + "&v=5.92";

            WebClient wc      = new WebClient();
            string    answer2 = Encoding.UTF8.GetString(wc.DownloadData(request3));
            like      lik     = JsonConvert.DeserializeObject <like>(answer2);

            for (int itemIndex = 0; itemIndex < gr.response.items.Length; itemIndex = itemIndex + 1)
            {
                string[] names = new string[3];
                names[0] = gr.response.items[itemIndex].text;
                names[1] = gr.response.items[itemIndex].owner_id.ToString();
                names[2] = gr.response.items[itemIndex].id.ToString();
                ListViewItem lvi = new ListViewItem(names, imageList1.Images.Count - 1);
                listView1.Items.Add(lvi);
            }
        }