public static PlanDesign LoadPlanDesign(string filePath, out string xmlCurr) { xmlCurr = null; YAXSerializer serializer = new YAXSerializer(typeof(PlanDesign)); if (string.IsNullOrEmpty(filePath)) { return(null); } try { xmlCurr = File.ReadAllText(filePath); } catch (IOException e) { MyLog.WARNING.WriteLine("Unable to read file " + filePath + " during curriculum loading. " + e.Message); return(null); } try { PlanDesign plan = (PlanDesign)serializer.Deserialize(xmlCurr); return(plan); } catch (YAXException e) { MyLog.WARNING.WriteLine("Unable to deserialize data from " + filePath + " during curriculum loading. " + e.Message); return(null); } }
public static void SavePlanDesign(PlanDesign design, string filePath, out string xmlResult) { YAXSerializer serializer = new YAXSerializer(typeof(PlanDesign)); xmlResult = serializer.Serialize(design); File.WriteAllText(filePath, xmlResult); MyLog.Writer.WriteLine(MyLogLevel.INFO, "School project saved to: " + filePath); }
public static void SavePlanDesign(PlanDesign design, string filePath) { string dummy; SavePlanDesign(design, filePath, out dummy); }
private void UpdateData() { if (!Visible || IsProjectUploaded) return; // update SchoolWorld SelectSchoolWorld(null, EventArgs.Empty); (m_mainForm.Project.World as SchoolWorld).Curriculum = m_design.AsSchoolCurriculum(m_mainForm.Project.World as SchoolWorld); // update curriculum detail grid List<LearningTaskNode> data = new List<LearningTaskNode>(); IEnumerable<LearningTaskNode> ltNodes = ActiveCurricula. SelectMany(x => (x as CurriculumNode).Nodes). Select(x => x as LearningTaskNode). Where(x => x.IsChecked == true); foreach (LearningTaskNode ltNode in ltNodes) data.Add(ltNode); Data = data; Design = m_design; Ready(); }
public static List<CurriculumNode> FromPlanDesign(PlanDesign design) { return design.Curricula.Select(FromCurriculumDesign).ToList(); }