private async void signBtn_Click(object sender, RoutedEventArgs e) { SignUpForm user = new SignUpForm() { username = user_name_textbox.Text, password = Password_box_signin.Password }; string jsonString = JsonConvert.SerializeObject(user); string result = await App.client.Login(jsonString.ToString()); Debug.WriteLine(result); LoginResponse resultObject = JsonConvert.DeserializeObject<LoginResponse>(result); if(resultObject.data.token != null) { App.client.setToken(resultObject.data.token); App.client.USERID = resultObject.data._id; App.connectView.TOKEN = resultObject.data.token ; App._token = resultObject.data.token; App._userid = resultObject.data._id; App._username = resultObject.data.username; IsolatedStorageSettings.ApplicationSettings["TOKEN"] = resultObject.data.token; IsolatedStorageSettings.ApplicationSettings["USERID"] = resultObject.data._id; IsolatedStorageSettings.ApplicationSettings["USERNAME"] = resultObject.data.username; NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } else { } }
private async void Submit_click(object sender, RoutedEventArgs e) { bool result; if (Pass_box.Password != "" && EmailTxt.Text != "" && Pass_box.Password == Passconfirm_box.Password && UserTxt.Text.Length>=3) { SignUpForm user = new SignUpForm() { username = UserTxt.Text, password = Pass_box.Password, country = CountryTxt.Text, email = EmailTxt.Text, phone = PhoneTxt.Text, gender = sex }; string jsonString = JsonConvert.SerializeObject(user); //result = await App.client.SignUp(jsonString); result = await App.client.SignUp(jsonString); if (result) { //Message_Ts.Message = "OK!"; MessageBox.Show("You have signup an accout"); Thread.Sleep(2000); //NavigationService.Navigate(new Uri("/LoginPage.xaml?username="******"&password="******"@")) { //Message_Ts.Message = "Email incorect!"; MessageBox.Show("Email incorect"); } else if (Pass_box.Password != Passconfirm_box.Password) { MessageBox.Show("Password and Password confirm must be the Same"); } else if (UserTxt.Text.Length < 3) { MessageBox.Show("Username must be 3 - 32 characters"); } else MessageBox.Show("Username & Password is require"); }