Exemplo n.º 1
0
        protected virtual void OnRoomDetailsChange(RoomBase room)
        {
            var handler = RoomDetailsChange;

            if (handler != null)
            {
                handler(room);
            }
        }
Exemplo n.º 2
0
        public void DisconnectSlaveRoom(RoomBase room)
        {
            if (_connectedRooms.Contains(room))
            {
                _connectedRooms.Remove(room);
#if DEBUG
                Debug.WriteWarn(string.Format("Room ID {0} disconnected from Room ID {1}", room.Id, Id));
#endif
                OnDivisibleStateChanged(room, DivisibleStateChangeType.Disconnected);
            }
        }
Exemplo n.º 3
0
        protected virtual void OnRoomOccupiedChange(RoomBase room, bool occupied)
        {
            var handler = RoomOccupiedChange;

            if (handler == null)
            {
                return;
            }
            try
            {
                handler(room, occupied);
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error raising event");
            }
        }
Exemplo n.º 4
0
        public void ConnectSlaveRoom(RoomBase room)
        {
            if (DivisibleRoomType != DivisibleRoomType.Master && room.DivisibleRoomType != DivisibleRoomType.Slave)
            {
                throw new Exception("Cannot connect these room types");
            }

            if (_connectedRooms.Contains(room))
            {
                return;
            }

            _connectedRooms.Add(room);
#if DEBUG
            Debug.WriteWarn(string.Format("Room ID {0} connected to Room ID {1}", room.Id, Id));
#endif
            OnDivisibleStateChanged(room, DivisibleStateChangeType.Connected);
        }
Exemplo n.º 5
0
        internal UserPrompt PromptUsers(RoomBase room, PromptUsersResponse responseCallBack, uint customSubPageJoin, string title, string subTitle,
                                        uint timeOutInSeconds, object userDefinedObject, params PromptAction[] promptActions)
        {
            var prompt = new UserPrompt
            {
                Room              = room,
                Actions           = promptActions.ToList(),
                CallBack          = responseCallBack,
                Title             = title,
                SubTitle          = subTitle,
                TimeOutInSeconds  = timeOutInSeconds,
                UserDefinedObject = userDefinedObject,
                CustomSubPageJoin = customSubPageJoin
            };

            AddPrompt(prompt);

            return(prompt);
        }
Exemplo n.º 6
0
        private void OnSourceChange(RoomBase room, SourceBase previousSource, SourceBase newSource)
        {
            var handler = SourceChange;
            var args    = new RoomSourceChangeEventArgs(previousSource, newSource);

            CloudLog.Info("{0} has changed sources from {1} to {2}", room,
                          previousSource != null ? previousSource.ToString() : "Off",
                          newSource != null ? newSource.ToString() : "Off");

            StartSourceChangeProcess(previousSource, newSource);

            try
            {
                if (handler != null)
                {
                    handler(room, args);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }
Exemplo n.º 7
0
 protected DisplayBase(RoomBase room, DisplayDeviceBase displayDevice)
     : this(room.System, displayDevice)
 {
     AssignToRoom(room);
 }
Exemplo n.º 8
0
 public void AssignToRoom(RoomBase room)
 {
     Room = room;
 }
Exemplo n.º 9
0
 protected abstract void OnDivisibleStateChanged(RoomBase room, DivisibleStateChangeType changeType);
Exemplo n.º 10
0
 /// <summary>
 /// Create a source which is local to a room and assigned for use only in the room
 /// </summary>
 /// <param name="room">The room which the source is assigned to</param>
 /// <param name="type">The type of source</param>
 /// <param name="device">The device driver for the source</param>
 protected SourceBase(RoomBase room, SourceType type, ISourceDevice device)
     : this(room.System, type, device)
 {
     _assignedRoom = room;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Get a collection of displays assigned to a room or are global
        /// </summary>
        /// <param name="room">A room</param>
        /// <returns>DisplayCollection</returns>
        public DisplayCollection ForRoomOrGlobal(RoomBase room)
        {
            var displays = this.Where(d => d.Room == room || d.Room == null);

            return(new DisplayCollection(displays));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Get a collection of displays assigned to a specific room
        /// </summary>
        /// <param name="room">A Room</param>
        /// <returns>DisplayCollection</returns>
        public DisplayCollection ForRoom(RoomBase room)
        {
            var displays = this.Where(d => d.Room == room);

            return(new DisplayCollection(displays));
        }
Exemplo n.º 13
0
 public SourceCollection GetSources(RoomBase room)
 {
     return(new SourceCollection(_collection.ForRoomOrGlobal(room).Where(s => s.Group == this)));
 }
Exemplo n.º 14
0
        /// <summary>
        /// Get a collection of sources assigned to a specific room or is a global source
        /// </summary>
        /// <param name="room">A room</param>
        /// <returns>SourceCollection</returns>
        public SourceCollection ForRoomOrGlobal(RoomBase room)
        {
            var sources = this.Where(s => (s.AssignedRoom == room || s.AssignedRoom == null) && !s.IsLocalToDisplayOnly);

            return(new SourceCollection(sources));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Get a collection of sources assigned to a specific room
        /// </summary>
        /// <param name="room">A Room</param>
        /// <returns>SourceCollection</returns>
        public SourceCollection ForRoom(RoomBase room)
        {
            var sources = this.Where(s => s.AssignedRoom == room);

            return(new SourceCollection(sources));
        }