示例#1
0
        public void AddChallenge(Challenge challenge)
        {
            if (Challenges.Any(c => c.Date.Date == DateTime.Today))
            {
                throw new ArgumentException("A challenge has already been chosen for today.");
            }

            Challenges.Add(challenge);
            challenge.Name = $"Challenge {Challenges.Count}";

            if (Challenges.Count == 1)
            {
                StartedAt = DateTime.Now;
            }
        }
示例#2
0
        public void AddChallenge(Challenge challenge)
        {
            if (Challenges.Any(c => (c.TimeToAccept > 0 && c.Done == false)))
            {
                throw new ArgumentException("A challenge has already been chosen for today.");
            }

            Challenges.Add(challenge);
            challenge.Name = $"Challenge {Challenges.Count}";

            if (Challenges.Count == 1)
            {
                StartedAt = DateTime.Now;
            }
            BadgeSigner.Instance.RewardBadges(this, challenge);
        }