コード例 #1
0
 private void RegisterButton_Click(object sender, EventArgs e)
 {
     try
     {
         string        username = NameInput.Text;
         string        email    = EmailInput.Text;
         string        pass     = PasswordInput.Text;
         string        repass   = ConfirmPasswordInput.Text;
         UInstaSR.User user     = new UInstaSR.User();
         user.username      = username;
         user.password      = pass;
         user.email         = email;
         user.dob           = new DateTime(dateTimePicker1.Value.Ticks);
         user.creation_date = DateTime.Now;
         UInstaSR.UserServiceClient client = new UInstaSR.UserServiceClient();
         client.CreateUser(user);
         this.Visible = false;
         Form f = new Login();
         f.Visible = true;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
コード例 #2
0
 private void fetchFollowers()
 {
     //for follower list
     followers = new List <UInstaSR.User>();
     fcomp     = new List <FollowingComponent>();
     try
     {
         UFInstaSR.IuserfollowServiceClient ufclient = new UFInstaSR.IuserfollowServiceClient();
         int[] idlist = ufclient.getFollowerList(InstaDB.user.userId);
         UInstaSR.UserServiceClient uclient = new UInstaSR.UserServiceClient();
         foreach (int id in idlist)
         {
             UInstaSR.User u = uclient.getUser(id);
             this.followers.Add(u);
             FollowingComponent comp = new FollowingComponent();
             comp.Follower = u.username;
             comp.Uid      = u.userId;
             fcomp.Add(comp);
         }
         InstaDB.followers = this.followers;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
コード例 #3
0
        private void Comments_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = comp.PostImage;
            label1.Text       = comp.Title;
            try
            {
                flowLayoutPanel1.Controls.Clear();
                UInstaSR.UserServiceClient     uclient = new UInstaSR.UserServiceClient();
                CInstaSR.IcommentServiceClient client  = new CInstaSR.IcommentServiceClient();
                this.commentlist = client.fetchComment(comp.Pid).OrderByDescending(c => c.creation_date).ToList();
                foreach (CInstaSR.Comment comment in commentlist)
                {
                    CommentComponent c = new CommentComponent();
                    c.CommentText = comment.comment;

                    c.Username = uclient.getUser(comment.userId).username;
                    subcomlist.Add(c);
                    flowLayoutPanel1.Controls.Add(c);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string name = textBox1.Text;

            try
            {
                UInstaSR.UserServiceClient client = new UInstaSR.UserServiceClient();
                List <UInstaSR.User>       users  = client.getUserWith(name).ToList();
                Dictionary <int, string>   dUsers = new Dictionary <int, string>();
                foreach (UInstaSR.User u in users)
                {
                    dUsers.Add(u.userId, u.username);
                }
                listBox1.DataSource    = new BindingSource(dUsers, null);
                listBox1.ValueMember   = "Key";
                listBox1.DisplayMember = "Value";
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string email = textBox1.Text;
         string pass  = textBox2.Text;
         UInstaSR.UserServiceClient client = new UInstaSR.UserServiceClient();
         UInstaSR.User user = client.getUserByEmail(email);
         if (user.password.Equals(pass))
         {
             InstaDB.loggedIn = true;
             InstaDB.user     = user;
             Form f = new Home();
             f.Show();
             this.Visible = false;
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }