public void UpdataFromFriend(Friend f) { user_id = f.user_id; if (f.ip != null) { ip = f.ip.GetAddressBytes(); } else { ip = null; } nickname = f.nickname; name = f.name; if (ext == null) { ext = new UserExt(); ext.Age = f.Age; ext.Country = f.Country; ext.GroupSet = f.GroupSet; ext.Hometown = f.Hometown; ext.Introduce = f.Introduce; ext.Level = f.Level; ext.Motto = f.Motto; ext.Telephone = f.Telephone; ext.User_Image = UserExt.ImageToBase64(f.User_Image as BitmapImage); } }
public void UpdatabyUser(User user) { user_id = user.user_id; name = user.name; if (user.ip == null) { ip = null; } else { ip = new IPAddress(user.ip); } nickname = user.nickname; var ex = user.ext; if (ex == null) { return; } User_Image = UserExt.Base64ToImage(ex.User_Image); Black_Image = ChangeToBlackBitmap(User_Image as BitmapImage); Level = ex.Level; Introduce = ex.Introduce; Age = ex.Age; Motto = ex.Motto; Hometown = ex.Hometown; Telephone = ex.Telephone; Country = ex.Country; GroupSet = ex.GroupSet; }
public User(int _id, byte[] _ip, string _name, string _nickname, UserExt _ext = null) { this.user_id = _id; this.ip = _ip; this.name = _name; this.ext = _ext; this.nickname = _nickname; }
//更新用户扩展信息头像,这个好说,已经测试了 public void UpdateUserExtInfoImage(int user_id, DrawBitmap.UserExt userExt)// { if (userExt.User_Image == "No Change" || userExt.User_Image == "NoChange") { return; } String sql = "UPDATE `drawtogether`.`user` SET " + "`User_Image` = '" + userExt.User_Image + "'" + " WHERE `user`.`id` =" + user_id + ";"; //Console.WriteLine("更改头像"); runSQL(sql); }
private void Button_Click_1(object sender, RoutedEventArgs e) { UserExt userext = new UserExt(); int.TryParse(age.Text, out userext.Age); userext.User_Image = UserExt.ImageToBase64(head.Source as BitmapImage); userext.Country = country.Text; userext.Hometown = hometown.Text; userext.Motto = motto.Text; userext.Introduce = introduce.Text; User user = Register.user; user.ext = userext; ServerAPI.UpdataMyInfo(user); LoginPage loginpage = new LoginPage(); loginpage.Username.Text = Register.user.name; NavigationService.Navigate(loginpage); }
private void Button_Click_1(object sender, RoutedEventArgs e) { UserExt userext = new UserExt(); int.TryParse(age.Text, out userext.Age); userext.User_Image = UserExt.ImageToBase64(head.Source as BitmapImage); userext.Country = country.Text; userext.Hometown = hometown.Text; userext.Motto = motto.Text; userext.Introduce = introduce.Text; User user = App.data.Me.toUser(); user.ext = userext; if (ServerAPI.UpdataMyInfo(user)) { App.data.Me.User_Image = head.Source; UserWindow.isNeedUpdate = true; } }
//为调试测试而生 public void showUserExt(DrawBitmap.UserExt userExt) { Console.WriteLine(userExt.Level + " " + userExt.Hometown + " " + userExt.Telephone); }