public void SaveUserLocalCache(List <string> recentList) //recentID的列表,recentID以“G_”或“U_”开头,以区分用户或组。 { if (recentList == null) { if (this.originUserLocalPersistence != null) { recentList = this.originUserLocalPersistence.RecentList; } } var cache = new UserLocalPersistence(this.userManager.GetAllReadonly(), this.groupManager.GetAll(), recentList); cache.Save(this.persistenceFilePath); }
private void Initialize(string curUserID, string persistencePath, string _companyGroupID, IAgileLogger _logger) { this.GroupChanged += delegate { }; this.FriendInfoChanged += delegate { }; this.FriendStatusChanged += delegate { }; this.FriendRemoved += delegate { }; this.FriendRTDataRefreshCompleted += new CbGeneric(GlobalUserCache_FriendRTDataRefreshCompleted); this.companyGroupID = _companyGroupID; this.logger = _logger; //自己的信息始终加载最新的 this.currentUser = this.DoGetUser(curUserID); this.userManager.Add(this.currentUser.ID, this.currentUser); this.persistenceFilePath = persistencePath; this.originUserLocalPersistence = UserLocalPersistence.Load(this.persistenceFilePath);//返回null,表示该登录帐号还没有任何缓存 if (this.originUserLocalPersistence != null && this.originUserLocalPersistence.FriendList != null) { foreach (var user in this.originUserLocalPersistence.FriendList) { if (user.ID == null) { continue; } if (user.ID != this.currentUser.ID) { user.UserStatus = UserStatus.OffLine; this.userManager.Add(user.ID, user); } } foreach (var group in this.originUserLocalPersistence.GroupList) { if (this.currentUser.GroupList.Contains(group.ID)) { this.groupManager.Add(group.ID, group); } } } }