Exemplo n.º 1
0
        public override object ToJson()
        {
            NodeModel node = new NodeModel() { id = Id, name = Name, count = OnlineUserCount, rootid = RoomGroupVM.RootRoomGroupVM.Id,maxcount = MaxUserCount };
            if (ImageVM != null)
				node.icon = ImageVM.StaticImageFile;
            return node;
        }
 private void OnlineUserCountChangedEventHandler(List<RoomViewModel> changedRooms)
 {
     List<TreeNodeModel> roomGroupsUserCount = new List<TreeNodeModel>();
     ApplicationVM.LocalCache.AllRoomGroupVMs.ForEach(g =>
         {
             var c = g.GetOnlineUserCount();
             if (g.OnlineUserCount != c)
             {
                 g.OnlineUserCount = c;
                 var node = new TreeNodeModel { id = g.Id, count = c, rootid = g.RootRoomGroupVM.Id, name = g.Name };
                 roomGroupsUserCount.Add(node);
             }
         });
     List<NodeModel> roomsUserCount = new List<NodeModel>();
     changedRooms.ForEach(r =>
         {
             var node = new NodeModel { id = r.Id, count = r.OnlineUserCount, rootid = r.RootRoomGroupVM.Id, name = r.Name };
             roomsUserCount.Add(node);
         });
     JavaScriptSerializer js = new JavaScriptSerializer();
     CallJavaScript("UpdateOnlineUserCountAsync", js.Serialize(roomGroupsUserCount), js.Serialize(roomsUserCount));
 }