Example #1
0
        public async Task <TupleValue <string, string>[]> VoteChoicesAsync()
        {
            var client   = new VotingService.VotingServiceClient(_channel);
            var request  = new VoteChoicesRequest();
            var response = await client.VoteChoicesAsync(request, cancellationToken : _tokenSource.Token);

            return(response.Choices.Select(c => TupleValue.Create(c.AgendaId, c.ChoiceId)).ToArray());
        }
Example #2
0
        public async Task <ushort> SetVoteChoicesAsync(TupleValue <string, string>[] choices)
        {
            var client  = new VotingService.VotingServiceClient(_channel);
            var request = new SetVoteChoicesRequest();

            request.Choices.AddRange(choices.Select(c => new SetVoteChoicesRequest.Types.Choice {
                AgendaId = c.Item1, ChoiceId = c.Item2
            }));
            var response = await client.SetVoteChoicesAsync(request, cancellationToken : _tokenSource.Token);

            return((ushort)response.Votebits);
        }