public WeeklyController(object obj)
 {
     list = obj as LifeList;
     name = list.name;
     meal = list.mealPlan.meals.First();
     exercise = list.exercisePlan.exercises.First();
 }
 public LifeStyleDescriptionController(object obj)
 {
     list = obj as LifeList;
     mealPlan = list.mealPlan;
     exercisePlan = list.exercisePlan;
     title = list.name;
     imageFixedPath = list.imageFixedPath;
     description = list.description;
     mealDuration = "Cooking Time   " + list.mealDuration;
     workoutDuration = "Workout Time   " + list.exerciseDuration;
 }
Example #3
0
        public List<LifeStyle> import()
        {
            List<LifeStyle> lifestyles = new List<LifeStyle>();
            objectMap = new Dictionary<string, baseObj>();
            using (XmlReader reader = XmlReader.Create("Assets\\data.xml"))
            {
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            switch (reader.Name)
                            {
                                case "Lifestylelist":
                                    LifeStyle style = new LifeStyle("Lifestylelist", reader);
                                    objectMap.Add(style.guid, style);
                                    lifestyles.Add(style);
                                    break;
                                case "Lifelist":
                                    LifeList list = new LifeList("Lifelist", reader);
                                    objectMap.Add(list.guid, list);
                                    break;
                                case "meal":
                                    Meal meal = new Meal("meal", reader);
                                    objectMap.Add(meal.guid, meal);
                                    break;
                                case "workout":
                                    Exercise exercise = new Exercise("workout", reader);
                                    objectMap.Add(exercise.guid, exercise);
                                    break;
                            }
                        break;
                    }
                }
            }

            foreach(var item in objectMap)
            {
                item.Value.Initialize();
            }

            return lifestyles;
        }