コード例 #1
0
        private async Task ListenCommandsAsync()
        {
            while (!_cancellationTokenSource.IsCancellationRequested)
            {
                var command = await _clientChannel.ReceiveCommandAsync(_cancellationTokenSource.Token);

                ProcessCommand(command);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: gecambridge/lime-csharp
        static async Task ConsumeCommandsAsync(IClientChannel clientChannel, CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                var command = await clientChannel.ReceiveCommandAsync(cancellationToken);

                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("Command with id '{0}' received from '{1}' - Method: {2} - URI: {3}", command.Id, command.From ?? clientChannel.RemoteNode, command.Method, command.Uri);
                Console.ResetColor();
            }
        }