Пример #1
0
        private void SetupTransformationGoalScreenButtonActions(Window window)
        {
            this.appViews.ChooseGoalScreen.SelectButton.Clicked += () =>
            {
                //mapper BiodataEntitie to Biodata
                BioData userBioData = new BioData(loggedInUser.BioData.Age, (GenderType)loggedInUser.BioData.Gender,
                                                  loggedInUser.BioData.Weight, loggedInUser.BioData.Height, loggedInUser.BioData.NeckSize,
                                                  loggedInUser.BioData.WaistSize, loggedInUser.BioData.HipsSize);

                //mapper UserEntitie to User
                User user = new User(loggedInUser.Username, userBioData);

                var currentFatPerc = this.bodyCalculator.CalculateBodyFat(user);
                var caloriesNeed   = this.bodyCalculator.CalculateCalories(user);


                IBodyTransformationGoal goal = transformationGoalFactory.GetGoal(this.appViews.ChooseGoalScreen.RadioGroup.Selected,
                                                                                 user.BioData.Weight,
                                                                                 currentFatPerc,
                                                                                 caloriesNeed);

                window.Remove(this.appViews.ChooseGoalScreen);
                string finalAdvise = string.Empty;

                if (goal != null)
                {
                    user.SetTransformationGoal(goal);
                    finalAdvise = user.Goal.ToString();

                    //Update user goal at db
                    loggedInUser.TrainingProgramAdvise = finalAdvise;
                    userService.UpdateUser(loggedInUser);

                    window.Add(new TextView {
                        Text = finalAdvise
                    });
                }

                Application.Run(window);
            };
        }
Пример #2
0
 //review this
 public void SetTransformationGoal(IBodyTransformationGoal goal)
 {
     this.Goal = goal;
 }