[mapguide-commits] r5939 - trunk/Tools/Maestro/Maestro.Base/Editor

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jun 22 08:48:03 EDT 2011


Author: jng
Date: 2011-06-22 05:48:03 -0700 (Wed, 22 Jun 2011)
New Revision: 5939

Modified:
   trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
Log:
#1722: Fix XML editor not previewing current XML content by overriding the default impl of SetupPreviewUrl for the generic XML editor


Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs	2011-06-22 12:40:40 UTC (rev 5938)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs	2011-06-22 12:48:03 UTC (rev 5939)
@@ -128,6 +128,20 @@
             }
         }
 
+        public override string SetupPreviewUrl(string mapguideRootUrl)
+        {
+            //Save the current resource to another session copy
+            string resId = "Session:" + this.EditorService.SessionID + "//" + Guid.NewGuid() + "." + this.Resource.ResourceType.ToString();
+            this.EditorService.ResourceService.SetResourceXmlData(resId, new MemoryStream(Encoding.UTF8.GetBytes(this.XmlContent)));
+
+            //Copy any resource data
+            var previewCopy = this.EditorService.ResourceService.GetResource(resId);
+            this.Resource.CopyResourceDataTo(previewCopy);
+
+            //Now feed it to the preview engine
+            return new ResourcePreviewEngine(mapguideRootUrl, this.EditorService).GeneratePreviewUrl(previewCopy);
+        }
+
         public override void SyncSessionCopy()
         {
             //Write our XML changes back into the edited resource copy and re-read



More information about the mapguide-commits mailing list