コード例 #1
0
ファイル: Login.xaml.cs プロジェクト: Ab159753/eLog
        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");
            }
        }
コード例 #2
0
ファイル: Search.xaml.cs プロジェクト: Ab159753/eLog
 public Search(UserPost userInfo)
 {
     InitializeComponent();
     this.userInfo = userInfo;
 }