Able to save / load schoolworkclass
This commit is contained in:
parent
3a30476c8f
commit
f6778026f2
@ -749,7 +749,8 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void btnHWSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//Prompt for the filename where to save it
|
||||
//Save the Schoolwork file
|
||||
}
|
||||
}
|
||||
}
|
@ -45,6 +45,11 @@ namespace EduNetworkBuilder
|
||||
Load(TheNode);
|
||||
}
|
||||
|
||||
public SchoolworkClass(string FileName)
|
||||
{
|
||||
Load(FileName);
|
||||
}
|
||||
|
||||
public SchoolworkClass(Network ToAdd, PersonClass WhoFor)
|
||||
{
|
||||
if(WhoFor != null && WhoFor.UserSettings != null)
|
||||
@ -96,6 +101,10 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
switch (Individual.Name.ToLower())
|
||||
{
|
||||
case "EduNetworkBuilderSchoolwork":
|
||||
case "schoolwork":
|
||||
Load(Individual);
|
||||
break;
|
||||
case "id":
|
||||
UInt64 tID;
|
||||
UInt64.TryParse(Individual.InnerText, out tID);
|
||||
@ -133,8 +142,20 @@ namespace EduNetworkBuilder
|
||||
|
||||
public void Save(string filename)
|
||||
{
|
||||
//Save to our pre-existing / pre-defined file
|
||||
Save(filename);
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = true;
|
||||
settings.NewLineOnAttributes = true;
|
||||
XmlWriter writer = XmlWriter.Create(filename, settings);
|
||||
|
||||
//Now we write the file:
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("EduNetworkBuilderSchoolwork");
|
||||
writer.WriteComment("This is a schoolwork file for EduNetworkBuilder.");
|
||||
Save(writer);
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
public void Save(XmlWriter writer)
|
||||
|
Loading…
Reference in New Issue
Block a user