Exemple #1
0
        public override void Execute(IEvent @event)
        {
            var isToggle = false;
            var token    = @event.Data as JToken;

            if (token != null && ((string)token).Equals("toggle"))
            {
                isToggle = true;
            }

            if (isToggle)
            {
                _apiAdapter.ToggleAutoDjLegacy();
            }

            var message = new SocketMessage(Constants.PlayerAutoDj, _apiAdapter.IsAutoDjEnabledLegacy());

            _hub.Publish(new PluginResponseAvailableEvent(message));
        }
Exemple #2
0
        public override void Execute(IEvent receivedEvent)
        {
            if (receivedEvent == null)
            {
                throw new ArgumentNullException(nameof(receivedEvent));
            }

            var isToggle = receivedEvent.Data is JToken token &&
                           ((string)token).Equals("toggle", StringComparison.InvariantCultureIgnoreCase);

            if (isToggle)
            {
                _apiAdapter.ToggleAutoDjLegacy();
            }

            var message = new SocketMessage(Constants.PlayerAutoDj, _apiAdapter.IsAutoDjEnabledLegacy());

            _hub.Publish(new PluginResponseAvailableEvent(message));
        }