示例#1
0
        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();
			}
        }
示例#2
0
        static void Main(String[] args)
        {
            if (args.Length > 0)
            {
                MessageBox.Show("" + args[0]);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainForm MainForm = new MainForm();
            User user = new User("Mattias");
            Presenter presenter = new Presenter(MainForm, user);
            Application.Run(MainForm);
        }