Exemplo n.º 1
0
 /**
  * Create a new user
  * Send post to server
  */
 async void HandleTouchUpInside(object sender, EventArgs ea)
 {
     if (userInput.Text != "")
     {
         User user = new User();
         user.username = userInput.Text;
         byte[] image = ReadFully(imageStream);
         await UserCall.createUser(image, "jpg", user);
     }
 }
Exemplo n.º 2
0
        //Prepares and performs an api call to register the new user
        public async void handleRegisterUser()
        {
            var  byteArray = IOSImageUtil.CompressImage(profileImage.Image);
            User user      = new User();

            user.username = tfUsername.Text;
            var userId = await UserCall.createUser(byteArray, "jpg", user);

            if (userId == -1)
            {
                lblWarning.Text = "Something went wrong, try again";
            }
            else
            {
                var plist = NSUserDefaults.StandardUserDefaults;
                plist.SetString(tfUsername.Text, "username");
                plist.SetString(imageUrl, "imageUrl");
                plist.SetInt(userId, "userId");
                DismissViewController(true, null);
            }
        }