Close any open rtf windows when we open the profile

This commit is contained in:
Tim Young 2017-07-31 19:26:04 -05:00
parent 3a7a3f4299
commit c7c563ce86

View File

@ -122,6 +122,8 @@ namespace EduNetworkBuilder
public PersonClass Edit()
{
CloseAllRTFWindows();
BuilderWindow BW = NB.GetBuilderWin();
if(BW != null)
{
@ -132,9 +134,20 @@ namespace EduNetworkBuilder
return CurrentUser;
}
private void CloseAllRTFWindows()
{
for(int i=Application.OpenForms.Count - 1; i>=0; i--)
{
if (Application.OpenForms[i] is RTFWindow)
Application.OpenForms[i].Close();
}
}
public PersonClass AddSchoolwork(Network ToAdd)
{
if (CurrentUser == null) return CurrentUser;
CloseAllRTFWindows();
BuilderWindow BW = NB.GetBuilderWin();
SchoolworkClass NewWork = new SchoolworkClass(ToAdd, CurrentUser);
CurrentUser.Projects.Add(NewWork);