private async void Register_Button(object sender, RoutedEventArgs e) { var username = Username.Text; var password = Password.Password; var confirmpassword = ConfirmPassword.Password; var fullname = Fullname.Text; var email = Email.Text; var birthday = BirthDay.Date; var avatar = ""; if (ChooseAvatar.Content.ToString() != "Choose File") { avatar = ChooseAvatar.Content.ToString(); } ; if (username == "") { Username_Message.Text = "Username is empty."; } else { Username_Message.Text = ""; this.account.username = username; }; if (password == "") { Password_Message.Text = "Password is empty."; } else { Password_Message.Text = ""; }; if (confirmpassword != password) { ConfirmPassword_Message.Text = "Confirm Password does not match"; } else { ConfirmPassword_Message.Text = ""; this.account.password = password; }; if (fullname == "") { Fullname_Message.Text = "Full Name is empty."; } else { Fullname_Message.Text = ""; this.account.fullname = fullname; }; if (!ValidateEmail(email)) { Email_Message.Text = "Email invalid."; } else { Email_Message.Text = ""; this.account.email = email; }; if (birthday >= DateTime.Today) { BirthDay_Message.Text = "Birth Day invalid."; } else { BirthDay_Message.Text = ""; this.account.birthday = birthday.ToString(); } if (Username_Message.Text == "" && Password_Message.Text == "" && ConfirmPassword_Message.Text == "" && Fullname_Message.Text == "" && Email_Message.Text == "" && birthday < DateTime.Today) { if (await ApiHandle.CheckExistsUsername(this.account.username)) { var response = await ApiHandle.Sign_Up(this.account); Debug.WriteLine(response); Username_Message.Text = ""; ContentDialog uploadSuccess = new ContentDialog() { Title = "Register success!", CloseButtonText = "Ok" }; await uploadSuccess.ShowAsync(); } else { Username_Message.Text = "Username exists."; } } }