示例#1
0
        protected virtual void OnRoomDetailsChange(RoomBase room)
        {
            var handler = RoomDetailsChange;

            if (handler != null)
            {
                handler(room);
            }
        }
示例#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);
            }
        }
示例#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");
            }
        }
示例#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);
        }
示例#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);
        }
示例#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);
            }
        }
示例#7
0
 protected DisplayBase(RoomBase room, DisplayDeviceBase displayDevice)
     : this(room.System, displayDevice)
 {
     AssignToRoom(room);
 }
示例#8
0
 public void AssignToRoom(RoomBase room)
 {
     Room = room;
 }
示例#9
0
 protected abstract void OnDivisibleStateChanged(RoomBase room, DivisibleStateChangeType changeType);
示例#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;
 }
示例#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));
        }
示例#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));
        }
示例#13
0
文件: SourceGroup.cs 项目: uxav/lib2
 public SourceCollection GetSources(RoomBase room)
 {
     return(new SourceCollection(_collection.ForRoomOrGlobal(room).Where(s => s.Group == this)));
 }
示例#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));
        }
示例#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));
        }