Пример #1
0
        private void dailyIntakeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dailyIntakeForm = new frmDailyIntakeWindow(_foodDatabaseController, _foodController, _repositoryFactory, user);

            this.Close();
            th = new Thread(delegate() {
                RunOnNextForm(dailyIntakeForm);
            });
            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
        private void saveCalorieLimitBtnStart_Click(object sender, EventArgs e)
        {
            if (calorieLimitTextBoxStart.Text == null || calorieLimitTextBoxStart.Text == "")
            {
                MessageBox.Show("Ne možete spremiti dnevni kalorijski unos jer ga niste izračunali! Ispunite formu, izračunajte kalorijski unos i pokušajte ponovno spremiti.");
                return;
            }

            _userController.AddUser(Double.Parse(calorieLimitTextBoxStart.Text, CultureInfo.InvariantCulture));

            IFoodDatabaseController _foodDatabaseController = new FoodDatabaseController(_formsFactory, _repositoryFactory);
            IFoodController         _foodController         = new FoodController(_formsFactory, _repositoryFactory);
            User user            = _userController.GetUser();
            var  dailyIntakeForm = new frmDailyIntakeWindow(_foodDatabaseController, _foodController, _repositoryFactory, user);

            this.Close();
            th = new Thread(delegate()
            {
                RunOnNextForm(dailyIntakeForm);
            });
            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }