From c7c563ce86685c407858a00c71ef50ec4c12b9fe Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 31 Jul 2017 19:26:04 -0500 Subject: [PATCH] Close any open rtf windows when we open the profile --- EduNetworkBuilder/PersonProfileForm.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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);