public Profile() { InitializeComponent(); DataContext = this; UserProfile userProfile = new UserProfile(); JObject json = SetProfile(userProfile); UserRegister result = json.ToObject <UserRegister>(new Newtonsoft.Json.JsonSerializer()); if (result == null) { string exception = json.ToObject <string>(new Newtonsoft.Json.JsonSerializer()); } else { this.UserName = result.Name; this.Name.Text = UserName; this.UserSurname = result.Surname; this.Surname.Text = UserSurname; this.UserEmail = result.Email; this.Email.Text = UserEmail; this.UserProfilePhoto = result.ProfilePhoto; this.ProfilePhoto.Text = UserProfilePhoto; this.BornDate.SelectedDate = UserBornDate; this.UserCountry = result.Country; this.Country.Text = UserCountry; } this.DataContext = new WindowViewModel(this); }
private void Button_Click(object sender, RoutedEventArgs e) { UserEdit userEdit = new UserEdit(UserName, UserSurname, UserEmail, UserProfilePhoto, UserBornDate, UserCountry); JObject json = UserEdit(userEdit); UserRegister result = json.ToObject <UserRegister>(new Newtonsoft.Json.JsonSerializer()); if (result == null) { string exception = json.ToObject <string>(new Newtonsoft.Json.JsonSerializer()); } else { } }
private void Button_Click(object sender, RoutedEventArgs e) { UserRegister ur = new UserRegister(UserName, UserSurname, UserEmail, UserProfilePhoto, UserBornDate, UserCountry); JObject json = callSync(ur); RegisterResult result = json.ToObject <RegisterResult>(new Newtonsoft.Json.JsonSerializer()); if (String.IsNullOrEmpty(result.TokenString)) { string exception = json.ToObject <string>(new Newtonsoft.Json.JsonSerializer()); } else { RunTimeVariables.TokenString = result.TokenString; RunTimeVariables.IdUser = result.IdUser; } SetPassword password = new SetPassword(); password.Show(); Close(); }
public JObject callSync(UserRegister ur) { JObject result = URL.AppendPathSegment("user/create").PostJsonAsync(ur).ReceiveJson <JObject>().Result; return(result); }