Save homework file button works

This commit is contained in:
Tim Young 2017-08-02 13:03:14 -05:00
parent f6778026f2
commit e488291152
2 changed files with 17 additions and 0 deletions

View File

@ -749,8 +749,20 @@ namespace EduNetworkBuilder
private void btnHWSave_Click(object sender, EventArgs e)
{
if (ViewedSchoolwork == null) return;
//Prompt for the filename where to save it
//Save the Schoolwork file
SaveFileDialog SFD = new SaveFileDialog();
SFD.InitialDirectory = CurrentUser.filepath; //Save wherever the teacher file is stored
SFD.OverwritePrompt = true;
SFD.FileName = ViewedSchoolwork.FileName;
SFD.AddExtension = true;
SFD.Filter = "EduNetworkBuilder Homework File (*.eduh)|*.eduh";
DialogResult Answer = SFD.ShowDialog();
if (Answer == DialogResult.Cancel) return;
//If we are here, we are ready to save it
ViewedSchoolwork.Save(SFD.FileName);
}
}
}

View File

@ -18,6 +18,11 @@ namespace EduNetworkBuilder
/// The name of the project. Homework3, Quiz 4, etc.
/// </summary>
public string Name = "";
/// <summary>
/// The Suggested filename for this homework. The Name + ".eduh"
/// </summary>
public string FileName { get { return Name + ".eduh"; } }
/// <summary>
/// The short description of the project.
/// </summary>