Пример #1
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            AddMsg("正在读取当前用户信息...");
            UserAPI userAPI = new UserAPI(App.Account);

            userAPI.Info((returnResult) =>
            {
                Result result = returnResult.Item1;
                Person person = returnResult.Item2;

                if (result.ErrCode == Result.SUCCESS)
                {
                    App.Account.Person = person;

                    this.Dispatcher.BeginInvoke(() =>
                    {
                        txtName.Text         = person.Name;
                        txtNickName.Text     = person.NickName;
                        txtFansCount.Text    = person.FansNum.ToString();
                        txtFavoursCount.Text = person.FavNum.ToString();
                        txtIdolsCount.Text   = person.IdolNum.ToString();
                        txtLevel.Text        = person.Level.ToString();
                        txtOpenId.Text       = person.OpenId;
                    });
                    AddMsg("读取当前用户信息完成");
                }
                else
                {
                    AddMsg("读取当前用户信息失败");
                    AddMsg(String.Format("ErrCode: {0}", result.Msg));
                }
            });
        }