예제 #1
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;
        }
 public LifeStyleListController(object obj)
 {
     style = obj as LifeStyle;
     lifeLists = style.lifeLists;
     title = style.name;
 }