Example #1
0
        public async void btn_Login(Object sender, System.EventArgs e)
        {
            Url = "http://192.168.1.111:8081/etm_log/api/project/log/login/username/" + username.Text + "/password/" + password.Text;
            string content = await _client.GetStringAsync(Url); //Sends a GET request to the specified Uri and returns the response body as a string in an asynchronous operation

            //List<Post> posts = JsonConvert.DeserializeObject<List<Post>>(content); //Deserializes or converts JSON String into a collection of Post
            UserPost posts = JsonConvert.DeserializeObject <UserPost>(content);

            if (posts.CodeUser != null)
            {
                Navigation.PushAsync(new Search(posts));
            }
            else
            {
                DisplayAlert("Login Fail", "Username or Paswword is invalid.", "OK");
                DisplayAlert("Login Fail", "Username or Paswword is invalid.", "OK");
            }
        }
Example #2
0
 public Search(UserPost userInfo)
 {
     InitializeComponent();
     this.userInfo = userInfo;
 }