public PageStudent(string Name,Profile.ProfileType Type) { this.profile = null; InitializeComponent(); init(Type,Name); }
public PageStudent(Profile profile) { this.profile = profile; InitializeComponent(); init(profile.Type); }
private void init(Profile.ProfileType Type,string Name="") { if (profile == null) { profile = new Profile(Type); profile.Name = Name; SaveRequired = true; } UpdateTitle(); profile.PropertyChanged += profile_PropertyChanged; pageProfile = new PageProfile(profile); pageAllMarks = new PageAllMarks(profile); AddTab(pageProfile , "Profile"); AddTab(pageAllMarks, "All Marks"); }
public static void SaveFile(Profile profile,string Path) { XElement ele = new XElement("Profile"); ele.Add(new XElement("ProfileType", (int)profile.Type)); ele.Add(new XElement("AppName", "TestFormula's StAnalysis")); ele.Add(new XElement("Address", profile.Address)); ele.Add(new XElement("Aim", profile.Aim)); ele.Add(new XElement("FamilyBackground", profile.FamilyBackground)); ele.Add(new XElement("Gender", (int)profile.Gender)); ele.Add(new XElement("InstituteName", profile.InstituteName)); ele.Add(new XElement("Interests", profile.Interests)); ele.Add(new XElement("Name", profile.Name)); ele.Add(new XElement("Version", profile.Version)); ele.Add(new XElement("WayOfStudy", profile.WayOfStudy)); XElement ele2 = new XElement("Standards"); foreach (Standard standard in profile.Standards) { ele2.Add(standard.GetXElement()); } ele.Add(ele2); ele.Save(Path); GC.Collect(); }
public static Profile LoadFile(string path) { if (!File.Exists(path)) { Console.WriteLine("File Not Found!!!"); throw new FileNotFoundException(); } if (!IsCorrectFormat(path)) { Console.WriteLine("Bad File Format"); throw new FileFormatException(); } XElement ele = XElement.Load(path); int Type = int.Parse( ele.Element("ProfileType").Value); Profile profile = new Profile((ProfileType)Type); profile.Address = ele.Element("Address").Value; profile.Aim= ele.Element("Aim").Value; profile.FamilyBackground = ele.Element("FamilyBackground").Value; profile.Gender = (GENDER)int.Parse(ele.Element("Gender").Value); profile.InstituteName = ele.Element("InstituteName").Value; profile.Interests = ele.Element("Interests").Value; profile.Name = ele.Element("Name").Value; profile.Version = double.Parse( ele.Element("Version").Value); profile.WayOfStudy = ele.Element("WayOfStudy").Value; XElement ele2 = ele.Element("Standards"); foreach (XElement eleStand in ele2.Elements()) { profile.Standards.Add(Standard.ReadStandard(eleStand)); } GC.Collect(); return profile; }
public PageStudentMarks(Profile profile) { this.profile = profile; InitializeComponent(); init(); }