diff --git a/EduNetworkBuilder/PersonProfileForm.cs b/EduNetworkBuilder/PersonProfileForm.cs index c3d973c..655fded 100644 --- a/EduNetworkBuilder/PersonProfileForm.cs +++ b/EduNetworkBuilder/PersonProfileForm.cs @@ -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);