Exemplo n.º 1
0
        private void get_users()
        {
            try
            {

                str_token = File.ReadAllText("25422596.txt");
               // MessageBox.Show(str_token);
                url = new Uri("https://api.vk.com/method/users.get.xml?" + fields + "&access_token=" + str_token);
                req = WebRequest.Create(url);
                resp = req.GetResponse();
                doc = XDocument.Load(resp.GetResponseStream());

                //url = new Uri("https://api.vk.com/method/users.get.xml?" + fields + "&access_token=" + str_token);
                //req = WebRequest.Create(url);
                //resp = req.GetResponse();
                //Stream stream = resp.GetResponseStream();
                //StreamReader sr = new StreamReader(stream);
                //string page_xml = sr.ReadToEnd();
                //sr.Close();
                //File.WriteAllText("user_Info", page_xml);

                var users = from us in doc.Descendants("user")
                            select new
                            {
                                uid = us.Element("uid").Value,
                                lastnm = us.Element("first_name").Value,
                                photo = us.Element("photo_200_orig").Value
                            };

                foreach (var item in users)
                {
                    lbl_name.Text = item.lastnm;
                    lbl_uid.Text = item.uid;
                    pb.ImageLocation = item.photo;
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
                Auth_Form frm = new Auth_Form();
                frm.ShowDialog();
            }
        }
Exemplo n.º 2
0
 private void cmd_Auth_Click(object sender, EventArgs e)
 {
     Auth_Form frm = new Auth_Form();
     frm.ShowDialog();
 }