public void AddContactLatest(ContactMember item)
        {
            var weChatUser = new WeChatUser()
            {
                Uin        = item.Uin,
                UserName   = item.UserName,
                NickName   = item.NickName,
                RemarkName = item.RemarkName,
                Sex        = item.Sex,
                Province   = item.Province,
                City       = item.City,
                HeadImgUrl = item.HeadImgUrl
            };

            //不存在 新增,存在 则排序到最前
            var isContains = false;

            foreach (var user in Contact_Latest)
            {
                if (user.UserName == weChatUser.UserName)
                {
                    isContains = true;
                    break;
                }
            }

            if (!isContains)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    Contact_Latest.Insert(0, weChatUser);
                });
            }
            else
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    var old = Contact_Latest.FirstOrDefault(x => x.UserName == weChatUser.UserName);
                    Contact_Latest.Remove(old);
                    Contact_Latest.Insert(0, weChatUser);
                });
            }
        }
示例#2
0
 public static bool IsGroup(this ContactMember member)
 {
     return(member.UserName.StartsWith("@@"));
 }
示例#3
0
 public static bool IsPublicUsers(this ContactMember member)
 {
     return((member.VerifyFlag & 8) != 0);
 }
示例#4
0
 public static bool IsSpecialUser(this ContactMember member)
 {
     return(SpecialUsers.Contains(member.UserName));
 }