Пример #1
0
        private void MyProfileBtn_Click(object sender, EventArgs e)
        {
            //GlobalAPI.GetCacheFileInfo("wangpengtest", CacheFileType.Image, 0, (info) =>
            //{

            //});
            ObjectPropertyInfoForm form = new ObjectPropertyInfoForm();

            form.Text               = "我的信息";
            form.TargetObject       = _selfNameCard;
            form.UpdateObjectAction = (o) =>
            {
                NIM.User.UserAPI.UpdateMyCard(o as UserNameCard, (a) =>
                {
                    if (a == ResponseCode.kNIMResSuccess)
                    {
                        UserAPI.GetUserNameCard(new List <string>()
                        {
                            SelfId
                        }, (ret) =>
                        {
                            if (ret.Any())
                            {
                                _selfNameCard = ret[0];
                                DisplayMyProfile(_selfNameCard);
                            }
                        });
                    }
                });
            };
            form.Show();
        }
Пример #2
0
        /// <summary>
        /// 初始聊天窗口
        /// </summary>
        public void init()
        {
            UserAPI.GetUserNameCard(new List <string> {
                targetId
            }, ret =>
            {
                if (ret != null && ret.Any())
                {
                    var headUrl = ret[0].IconUrl;
                    if (!string.IsNullOrEmpty(headUrl))
                    {
                        mlcMessage.target = NimUtil.getHeadImage(headUrl);
                        return;
                    }
                }

                mlcMessage.target = Util.getImage("icons/head.png");
            });

            if (myHead == null)
            {
                UserAPI.GetUserNameCard(new List <string> {
                    myId
                }, ret =>
                {
                    if (ret != null && ret.Any())
                    {
                        var headUrl = ret[0].IconUrl; if (!string.IsNullOrEmpty(headUrl))
                        {
                            myHead        = NimUtil.getHeadImage(headUrl);
                            mlcMessage.me = myHead;

                            return;
                        }
                    }

                    myHead        = Util.getImage("icons/head.png");
                    mlcMessage.me = myHead;
                });
            }
            else
            {
                mlcMessage.me = myHead;
            }
        }