示例#1
0
        public void UpdateUserInfo()
        {
            try
            {
                var postdata = $"type=base&credit={UserData.credit}";
                var result   = JsonConvert.DeserializeObject <ResponceModel <_UserInfo> >(HttpUtil.post(API[APIKey.GetInfo], postdata));

                if (result.code == 200)
                {
                    // TODO 正在修改
                    UserData.nickname = result.data.nickname;
                    UserData.Portrait = ToolUtil.BytesToBitmapImage(ToolUtil.HexToBytes(result.data.portrait));
                    UserData.email    = result.data.email;
                    UserData.phone    = result.data.phone;

                    UserData.userstate = Data.UserState.Success;
                }
                else
                {
                    UserData.userstate = Data.UserState.Waring;
                }
                MessageInvoked?.Invoke(this, new MessageEventArgs("getinfo_base", result.msg));
            }
            catch (Exception ex)
            {
                MessageInvoked?.Invoke(this, new MessageEventArgs("getinfo_base", $"获取用户基础信息失败 {ex.Message}"));
            }
        }