/// <summary> /// Invokes CompleteActivity with CurrentActivity as activity. /// </summary> /// <param name="grade">What grade the user gives the activity.</param> /// <param name="comment">Any feedback the user leaves to the activity. Can be left blank or nulled.</param> /// <returns>A list of the name of all trophies and challenges that was earned. If nothing is earned then an empty list, safe to use for each.</returns> public List <Notification> CompleteCurrentActivity(int grade, string comment) { var ChallengeActivated = connectToDatabase.onGoingChallenge(Username); connectToDatabase.SubmitComment(grade, comment, Username, CurrentActivity.Activity.Name); connectToDatabase.CompleteActivity(Username, CurrentActivity.Activity.Name); trophiesEarned = connectToDatabase.getTrophiesEarnedAfterActivity(Username); var notifications = new List <Notification>(); // add all, if any, trophies earned to the list foreach (Trophy t in trophiesEarned) { notifications.Add(new Notification("Trophy Earned!", "Congratulations, you earned the trophy: " + t.Name + "!")); } foreach (Trophy t in trophiesEarned) { Debug.WriteLine("" + t.Name); } // reset CurrentActivity and done DropCurrentActivity(); return(notifications); }