예제 #1
0
        private static void RegisterPlaybackActionCommandReceivedEvent()
        {
            _playbackActionCommandCallback = (clientName, requestId, playbackCommand, _) =>
            {
                var command = new PlaybackCommand(playbackCommand.ToPublic());
                command.SetResponseInformation(clientName, requestId);

                PlaybackActionCommandReceived?.Invoke(null, new PlaybackActionCommandReceivedEventArgs(command));
            };
            Native.SetPlaybackActionCommandReceivedCb(Handle, _playbackActionCommandCallback).
            ThrowIfError("Failed to init PlaybackActionCommandReceived event.");
        }
예제 #2
0
        private static void RegisterPlaybackActionCommandReceivedEvent()
        {
            _playbackActionCommandCallback = (clientName, requestId, playbackCommand, _) =>
            {
                // SendPlaybackCommand doesn't use requestId. It'll be removed in Level 7.
                if (requestId == null)
                {
                    PlaybackCommandReceived?.Invoke(null, new PlaybackCommandReceivedEventArgs(clientName, playbackCommand.ToPublic()));
                }
                else
                {
                    var command = new PlaybackCommand(playbackCommand.ToPublic());
                    command.SetResponseInformation(clientName, requestId);

                    PlaybackActionCommandReceived?.Invoke(null, new PlaybackActionCommandReceivedEventArgs(command));
                }
            };
            Native.SetPlaybackActionCommandReceivedCb(Handle, _playbackActionCommandCallback).
            ThrowIfError("Failed to init PlaybackActionCommandReceived event.");
        }