[mapguide-commits] r4831 - trunk/Tools/Maestro/Maestro

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 4 20:46:06 EDT 2010


Author: jng
Date: 2010-05-04 20:46:05 -0400 (Tue, 04 May 2010)
New Revision: 4831

Modified:
   trunk/Tools/Maestro/Maestro/FormMain.cs
Log:
Fix #1346: The close/save all functions were not calling the tree update method which updates the color states.

Modified: trunk/Tools/Maestro/Maestro/FormMain.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/FormMain.cs	2010-05-05 00:05:23 UTC (rev 4830)
+++ trunk/Tools/Maestro/Maestro/FormMain.cs	2010-05-05 00:46:05 UTC (rev 4831)
@@ -2330,18 +2330,21 @@
 
 		private void SaveAllResources()
 		{
-			try
-			{
-				foreach(OSGeo.MapGuide.Maestro.EditorInterface edi in this.OpenResourceEditors.Values)
-					if (edi.Page.Text.EndsWith(" *"))
-						edi.Save();
-			}
-			catch(Exception ex)
-			{
+            try
+            {
+                foreach (OSGeo.MapGuide.Maestro.EditorInterface edi in this.OpenResourceEditors.Values)
+                    if (edi.Page.Text.EndsWith(" *"))
+                        edi.Save();
+            }
+            catch (Exception ex)
+            {
                 LastException = ex;
-				MessageBox.Show(this, string.Format(Strings.FormMain.SaveResourceError, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
-			}
-
+                MessageBox.Show(this, string.Format(Strings.FormMain.SaveResourceError, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+            }
+            finally
+            {
+                UpdateResourceTreeStatus();
+            }
 		}
 
 		private void MainMenuSaveAsXml_Click(object sender, System.EventArgs e)
@@ -2672,14 +2675,19 @@
             }
 		}
 
-		public void UpdateResourceTreeStatus()
+        public void UpdateResourceTreeStatus()
+        {
+            UpdateResourceTreeStatus(m_userControls.Values);
+        }
+
+		private void UpdateResourceTreeStatus(IEnumerable<EditorInterface> editors)
 		{
             try
             {
                 ResourceTree.BeginUpdate();
 
                 // start looping through open editors
-                foreach (EditorInterface ediThis in m_userControls.Values)
+                foreach (EditorInterface ediThis in editors)
                 {
                     TreeNode item = FindItem(ediThis.ResourceId, true);
                     if (ediThis.IsClosing)
@@ -3086,9 +3094,13 @@
 
         private void MainMenuCloseAll_Click(object sender, EventArgs e)
         {
-            foreach (EditorInterface edi in new List<EditorInterface>(m_userControls.Values))
+            var editors = new List<EditorInterface>(m_userControls.Values);
+            foreach (EditorInterface edi in editors)
+            {
                 if (!edi.Close(true))
-                    return;
+                    break;
+            }
+            UpdateResourceTreeStatus(editors);
         }
 	}
 }



More information about the mapguide-commits mailing list