コード例 #1
0
        private UserTimeoutAction FormTimeoutHandler(User user, UserFormSubmission submission)
        {
            T objectVotedFor = TryExtractObjectVotedFor(user, submission);

            // TODO: Support ability to not count a vote.
            if (objectVotedFor == null)
            {
                objectVotedFor = ObjectList.First();
            }
            VoteInfo vote = new VoteInfo
            {
                ObjectsVotedFor = new List <object> {
                    objectVotedFor
                },
                TimeTakenInMs = DateTime.UtcNow.Subtract(this.StartingTime).TotalMilliseconds,
                UserWhoVoted  = user
            };

            objectVotedFor.VotesCastForThisObject.Add(vote);
            this.UserVotes[user] = vote;
            return(UserTimeoutAction.None);
        }