getting ready to load homework
This commit is contained in:
parent
8fe0cf2df7
commit
6467013f52
@ -1760,6 +1760,7 @@ namespace EduNetworkBuilder
|
|||||||
MessageBox.Show(NB.Translate("NB_LoadUserFirst"));
|
MessageBox.Show(NB.Translate("NB_LoadUserFirst"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//Here we would load a homework file
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -853,9 +853,20 @@ namespace EduNetworkBuilder
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show(HWClassList.Count.ToString() + " selected");
|
OpenFileDialog mydialog = new OpenFileDialog();
|
||||||
//Choose a file
|
mydialog.AddExtension = true;
|
||||||
|
//If we have a user loaded, we can open homework files
|
||||||
|
string filter = "EduNetworkBuilder Homework File (*.enbh)|*.enbh;";
|
||||||
|
mydialog.Filter = filter;
|
||||||
|
mydialog.Multiselect = false;
|
||||||
|
mydialog.ShowHelp = true;
|
||||||
|
mydialog.CheckFileExists = true;
|
||||||
|
mydialog.CheckPathExists = true;
|
||||||
|
DialogResult result = mydialog.ShowDialog();
|
||||||
|
if (result == System.Windows.Forms.DialogResult.Cancel) return; //Choose a file
|
||||||
//save that list in that file
|
//save that list in that file
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnReadAllStudentHomework_Click(object sender, EventArgs e)
|
private void btnReadAllStudentHomework_Click(object sender, EventArgs e)
|
||||||
|
@ -168,6 +168,27 @@ namespace EduNetworkBuilder
|
|||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Save(List<SchoolworkClass> homeworks, string 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.");
|
||||||
|
foreach (SchoolworkClass swc in homeworks)
|
||||||
|
{
|
||||||
|
swc.Save(writer);
|
||||||
|
}
|
||||||
|
writer.WriteEndElement();
|
||||||
|
writer.WriteEndDocument();
|
||||||
|
writer.Flush();
|
||||||
|
writer.Close();
|
||||||
|
}
|
||||||
|
|
||||||
public void Save(XmlWriter writer)
|
public void Save(XmlWriter writer)
|
||||||
{
|
{
|
||||||
//Save the language name
|
//Save the language name
|
||||||
|
Loading…
Reference in New Issue
Block a user