コード例 #1
0
        private void button2_Click_2(object sender, EventArgs e)
        {
            Instagram test = new Instagram(token);

            User user = new User();
            user.login = textBox3.Text;

            if (user.GetUserInformation(user).isClosed)
            {
                follow();
            }
            else
            {
                List<Image> list = user.GetImages(1, 12);
                //list = user.GetImages(12, 12);

                for(int x = 0; x< 4; x++)
                {
                    for(int y = 0; y<3;y++)
                    {
                        if (list.Count > y * 4 + x)
                        {
                            myPictureBox box = new myPictureBox();
                            box.Size = new Size(150, 150);
                            box.Click += box_Click;
                            box.link = list[y * 4 + x].highResolution.ToString();
                            box.Cursor = Cursors.Hand;
                            box.Location = new Point(20 + x * (150 + 40), 62 + y * (150 + 20));
                            box.ImageLocation = list[y * 4 + x].thumbNail.ToString();
                            this.Controls.Add(box);
                        }
                        else
                        {
                           //
                        }
                    }
                }
            }
        }
コード例 #2
0
 public User GetUserInformation(User incUser)
 {
     string id = GetId(incUser.login, accessTokenUser);
     if (id == null)
     {
         return null;
     }
     string requestUrl = MakeUlr("userInformation", id, accessTokenUser);
     try
     {
         string content = GetHtml(requestUrl);
         if (content != null)
         {
             dynamic information = JsonConvert.DeserializeObject(content);
             User user = new User()
             {
                 login = information.data.username,
                 profileImage = information.data.profile_picture,
                 isClosed = false
             };
             return user;
         }
         else
         {
             User user = new User()
             {
                 login = "******",
                 isClosed = true,
                 profileImage = null
             };
             return user;
         }
     }
     catch
     {
         User user = new User()
         {
             login = "******",
             isClosed = true,
             profileImage = null
         };
         return user;
     }
     //return null;
 }