示例#1
0
        public void Rerender()
        {
            if (_chats == null)
            {
                return;
            }
            List <IMenuItem> children = _root.GetChildren();

            children.ForEach(x => { _root.RemoveChild(x); x.Dispose(); });
            Dictionary <ulong, FriendsAppUser> friends = _api.DefaultApps.Friends.ListFriends().Wait().ToDictionary(x => x.UserId, x => x);
            ulong userId = _api.User.UserId.Value;

            foreach (ChatObj chat in _chats)
            {
                if (chat.Messages.Count == 0)
                {
                    continue;
                }
                ulong  otherUser = chat.User1 == userId ? chat.User2 : chat.User1;
                string username;
                if (friends.TryGetValue(otherUser, out FriendsAppUser friend))
                {
                    username = friend.Username;
                }
                else
                {
                    username = "******";
                }
                _root.AddChildBottom(CreateUserBlock(username, chat), BLOCK_HEIGHT);
            }
        }
示例#2
0
        public void Update()
        {
            _root.GetChildren().ForEach(x => { _root.RemoveChild(x); x.Dispose(); });
            List <FriendsAppUser> friends = _api.DefaultApps.Friends.ListFriends().Wait();

            foreach (FriendsAppUser friend in friends)
            {
                _root.AddChildBottom(CreateBlock(friend), 20);
            }
        }
示例#3
0
 private void Rerender()
 {
     if (_currChat == null)
     {
         return;
     }
     _chatItem.GetChildren().ForEach(x => { _chatItem.RemoveChild(x); x.Dispose(); });
     foreach (ChatObjMsg msg in _currChat.Messages)
     {
         _chatItem.AddChildBottom(CreateMessageObj(msg), CalculateHeight(msg.Message));
     }
 }