Example #1
0
 public void AddRoom(Room room)
 {
     if (room.Users == null)
     {
         room.Users = new User[]{};
     }
     _rooms.Add(room);
     _allRooms.Add(room);
 }
        public IModule CreateRoomModule(Room room)
        {
            var vm = _container.Resolve<IRoomModuleViewModel>(new {room});
            var module = _container.Resolve<IModule>(ModuleNames.RoomModule, new {vm});

            _roomModules[module] = vm;

            _bus.SendMessage(new RoomModuleCreatedMessage(module));
            return module;
        }
        public RoomListViewModel(Room room, IMessageBus bus)
        {
            _room = room;
            _bus = bus;

            bus.Listen<RoomPresenceMessage>().SubscribeUI(msg => IsActive = msg.IsPresentIn(_room.Id));

            _bus.Listen<RoomActivatedMessage>().Where(msg => msg.RoomId == _room.Id)
                .Do(_ => IsJoiningRoom = false)
                .SubscribeUI(_ => IsCurrentRoom = true);

            _bus.Listen<RoomDeactivatedMessage>().Where(msg => msg.RoomId == _room.Id)
                .SubscribeUI(_ => IsCurrentRoom = false);

            _bus.Listen<RoomActivityMessage>().Where(msg => msg.RoomId == _room.Id)
                .SubscribeUI(msg => RoomActivityCount += msg.Count);

            JoinCommand = new ReactiveCommand();
            JoinCommand.Do(_ => IsJoiningRoom = true).SubscribeUI(HandleJoinCommand);
        }
Example #4
0
 public RoomPresenceMessage(Room[] rooms)
 {
     _rooms = rooms;
 }
Example #5
0
 public RoomListMessage(Room[] rooms)
 {
     Rooms = rooms;
 }
Example #6
0
 public RoomInfoReceivedMessage(Room room)
 {
     Room = room;
 }