internal void OnNewQuestionAvailable(Question newQuestion)
 {
     this.NewQuestionAvailable(this, new QuestionEventArgs { Question = newQuestion });
 }
        public async Task SendQuestion(Question question)
        {
            List<Guid> clientList = new List<Guid>();

            foreach (var key in this.PlayerMap.Keys)
            {
                clientList.Add(this.PlayerMap[key]);
            }

            var messageTasks = clientList.Select(client => this.Host.SendMessage(client, 
                new HostMessage { MessageType = HostMessageType.Question, Question = question }, typeof(HostMessage)));

            // When all the tasks complete, return true if they all succeeded. 
            bool status = (await Task.WhenAll(messageTasks)).All(value => { return value; });
        }
        public async Task SendQuestion(Question question)
        {
            this.Client1.OnNewQuestionAvailable(question);
			this.Client2.OnNewQuestionAvailable(question);
		}
        public async Task SendQuestionAsync(Question question)
        {
            var clientList = new List<Guid>();
            clientList.AddRange(_playerToParticipantMap.Values);

            string message = 
                $"{QUESTION_COMMAND}-{question.Text}-{question.CorrectAnswerIndex}-{question.Options.Count}" +
                $"-{string.Join("-",question.Options)}";

            var messageTasks = clientList.Select(client =>
                _manager.CreateCommunicationChannel(client).SendRemoteMessageAsync(message));

            await Task.WhenAll(messageTasks);
        }
 public Task SendQuestionAsync(Question question)
 {
     this.Client1.OnNewQuestionAvailable(question);
     this.Client2.OnNewQuestionAvailable(question);
     return Task.CompletedTask;
 }