Exemplo n.º 1
0
        public override void Execute(IEvent @event)
        {
            if (!(@event.Data is JToken token) || token.Type != JTokenType.Integer)
            {
                return;
            }

            var newVolume = token.Value <int>();
            var volume    = _apiAdapter.GetVolume();

            if (newVolume == volume)
            {
                return;
            }

            _apiAdapter.SetVolume(newVolume);
        }
Exemplo n.º 2
0
        public override void Execute(IEvent receivedEvent)
        {
            if (receivedEvent == null)
            {
                throw new ArgumentNullException(nameof(receivedEvent));
            }

            if (!(receivedEvent.Data is JToken token) || token.Type != JTokenType.Integer)
            {
                return;
            }

            var newVolume = token.Value <int>();
            var volume    = _apiAdapter.GetVolume();

            if (newVolume == volume)
            {
                return;
            }

            _apiAdapter.SetVolume(newVolume);
        }