public static AgentCache GetInstance() { if (AgentCache.Instance == null) { AgentCache.Instance = new AgentCache(); } return(AgentCache.Instance); }
void ChatProtocol_Opened(object sender, EventArgs e) { // 缓存Agent AgentCache.GetInstance().AddItem(this.agent); if (!this.Room.Partys.Exists(item => item.UserType == UserType.Agent && item.DisplayName == this.agent.DisplayName)) { this.Room.Partys.Add(this.agent); } // 记录统计信息 AgentCache.GetInstance().LogCurrentAgentInfo(); ChatRoomCache.GetInstance().LogCurrentRoomInfo(); }