/// <summary> /// 创建事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Button_Click(object sender, RoutedEventArgs e) { if (password.Password != againpassword.Password) { MessageBox.Show("两次输入密码不一致"); } List <string> roles = new List <string>(); foreach (CheckBox item in roleNames.Children) { if (item.IsChecked == true) { roles.Add(item.Content.ToString()); } } UserRule user = new UserRule() { emailAddress = emailAddress.Text, userName = userName.Text, name = name.Text, password = password.Password, surname = surname.Text, roleNames = roles.ToArray() }; var result = await userRequest.CreateRequest(Uris.BaseUrl + Uris.User + "Create", user); if ((bool)result["success"]) { NewId = result["result"]["id"].ToString(); var re = await UploadImage(); if (re != null && !(bool)re["success"]) { MessageBox.Show(re["error"]["message"].ToString()); } else { GoBack(); } } else { MessageBox.Show(result["error"]["message"].ToString()); } }