예제 #1
0
        public void Execute(IEvent receivedEvent)
        {
            if (receivedEvent == null)
            {
                throw new ArgumentNullException(nameof(receivedEvent));
            }

            var from = -1;
            var to   = -1;

            var success = false;

            if (receivedEvent.Data is JToken token && token.Type == JTokenType.Object)
            {
                from    = (int)token["from"];
                to      = (int)token["to"];
                success = _nowPlayingApiAdapter.MoveTrack(from, to);
            }

            var reply = new { success, from, to };

            var message = new SocketMessage(Constants.NowPlayingListMove, reply);

            _hub.Publish(new PluginResponseAvailableEvent(message, receivedEvent.ConnectionId));
        }
예제 #2
0
        public void Execute(IEvent @event)
        {
            var from = -1;
            var to   = -1;

            var success = false;
            var token   = @event.Data as JToken;

            if (token != null && token.Type == JTokenType.Object)
            {
                from    = (int)token["from"];
                to      = (int)token["to"];
                success = _nowPlayingApiAdapter.MoveTrack(from, to);
            }

            var reply = new
            {
                success,
                from,
                to
            };

            var message = new SocketMessage(Constants.NowPlayingListMove, reply);

            _hub.Publish(new PluginResponseAvailableEvent(message, @event.ConnectionId));
        }