public Presenter(MainForm view, User user) { connectToDatabase = new ConnectToDatabase("halso_hub"); this.user = user; this.view = view; moodButtonState = 0; view.setPresenter(this); setupGUI(); if (connectToDatabase.onGoingChallenge(user.Username) == true) { ChallengeActivitiesLeftInCurrentChallenge(); StartChallengeButtonPressed(); view.HideChallengesDisplayed(); view.ShowActivitiesForChallenge(); currentChallengeHover = connectToDatabase.GetCurrentChallenge(user.Username); Challenge startedChallenge = user.GetChallengeQuery(currentChallengeHover); if (startedChallenge != null && challengeSelected == false) { challengeSelected = true; user.SetCurrentChallenge(startedChallenge); } view.ChangeChallengeDescriptionAndLabel(startedChallenge.Name, startedChallenge.Description); } else { GetAndShowChallenges(); } }
public Presenter(MainForm view, User user) { connectToDatabase = new ConnectToDatabase("halso_hub"); this.user = user; this.view = view; moodButtonState = 0; view.setPresenter(this); setupGUI(); if (connectToDatabase.onGoingChallenge(user.Username) == true) { ChallengeActivitiesLeftInCurrentChallenge(); StartChallengeButtonPressed(); view.HideChallengesDisplayed(); view.ShowActivitiesForChallenge(); currentChallengeHover = connectToDatabase.GetCurrentChallenge(user.Username); Challenge startedChallenge = user.GetChallengeQuery(currentChallengeHover); if (startedChallenge != null && challengeSelected == false) { challengeSelected = true; user.SetCurrentChallenge(startedChallenge); } view.ChangeChallengeDescriptionAndLabel(startedChallenge.Name, startedChallenge.Description); } else { GetAndShowChallenges(); } }
/// <summary> /// TEMPORARY /// Constructs a user with its fields. /// </summary> /// <param name="username">Name of the user.</param> public User(string username) { connectToDatabase = new ConnectToDatabase("halso_hub"); Username = username; CurrentMood = new List<MoodType>(); }
/// <summary> /// TEMPORARY /// Constructs a user with its fields. /// </summary> /// <param name="username">Name of the user.</param> public User(string username) { connectToDatabase = new ConnectToDatabase("halso_hub"); Username = username; CurrentMood = new List <MoodType>(); }