Exemplo n.º 1
0
        protected virtual void OnSourceChange(SourceBase source)
        {
            CloudLog.Debug("{0} set to Source: {1}", this, source != null ? source.ToString() : "None");

            if (source == null || _displayDevice == null)
            {
                return;
            }
            if (!_displayDevice.Power)
            {
                CloudLog.Debug("{0} Power set to On!", this);
                _displayDevice.Power = true;
            }
            try
            {
                if (Room != null && Room.GetDisplayInputOverrideForSource(this, source) != DisplayDeviceInput.Unknown)
                {
                    RouteSourceDisplayDeviceInput(Room.GetDisplayInputOverrideForSource(this, source));
                }
                else if (source.DisplayDeviceInput != DisplayDeviceInput.Unknown)
                {
                    RouteSourceDisplayDeviceInput(source.DisplayDeviceInput);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error setting input for display");
            }
        }
Exemplo n.º 2
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);
            }
        }