示例#1
0
        public void SetUp()
        {
            words = new List <Word>();
            words.Add(new Word()
            {
                source = "Hello", target = "Hola"
            });
            words.Add(new Word()
            {
                source = "Bye", target = "Chau"
            });

            wordRandomizer = new WordRandomizer(words);
        }
示例#2
0
        public async Task BeginGame()
        {
            var currentUser  = users.FirstOrDefault(User => User.ConnectionId == Context.ConnectionId);
            var currentGroup = users.FindAll(User => User.GroupId == currentUser.GroupId);

            if (currentGroup.Count < 2)
            {
                return;
            }
            var administrator = GetAdministrator(currentGroup);

            groupWords[currentUser.GroupId.ToString()] = WordRandomizer.GetWord();
            await Clients.Client(administrator.ConnectionId).SendAsync("BeginGame", groupWords[currentUser.GroupId.ToString()]);

            await Send("BeginGame");
        }