Esempio n. 1
0
        /// <summary>
        /// Adds a "yes" or a "no" to the given vote
        /// </summary>
        /// <param name="user">The user voting</param>
        /// <param name="vote">The vote we are handling</param>
        /// <param name="answer">True = "yes", False = "no"</param>
        private void AddVote(IrcUser user, Vote vote, bool answer)
        {
            if (VoteReceived != null)
            {
                VoteReceived(vote, user, answer);
            }

            if (vote.CanVote(user))
            {
                // Answer is yes
                if (answer)
                {
                    vote.PositiveCount += 1;
                }

                // Answer is no
                else
                {
                    vote.NegativeCount += 1;
                }

                // We add a user to it's corresponding vote so that no one can vote more than once
                vote.votedUsers.Add(user);
            }
        }