[mapguide-commits] r6735 - in trunk/Tools/Maestro: Maestro.Base/Editor Maestro.Editors/Generic

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jun 6 04:38:16 PDT 2012


Author: jng
Date: 2012-06-06 04:38:16 -0700 (Wed, 06 Jun 2012)
New Revision: 6735

Modified:
   trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
   trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
Log:
#2016: Fix trailing characters due to faulty formatting logic. Since we've moved to the ICSharpCode.TextEditor component, we can probably remove this function in the future.

Also fix a threading issue with XML validation (probably due to the introduction of the ICSharpCode.TextEditor component)

Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs	2012-06-05 14:52:05 UTC (rev 6734)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs	2012-06-06 11:38:16 UTC (rev 6735)
@@ -78,36 +78,44 @@
             string[] warnings;
             string[] errors;
 
-            ValidateXml(out errors, out warnings);
-            var issues = new List<ValidationIssue>();
-            foreach (string err in errors)
+            Func<ValidationIssue[]> validator = () =>
             {
-                issues.Add(new ValidationIssue(this.Resource, ValidationStatus.Error, ValidationStatusCode.Error_General_ValidationError, err));
-            }
-            foreach (string warn in warnings)
-            {
-                issues.Add(new ValidationIssue(this.Resource, ValidationStatus.Warning, ValidationStatusCode.Warning_General_ValidationWarning, warn));
-            }
+                ValidateXml(out errors, out warnings);
+                var issues = new List<ValidationIssue>();
+                foreach (string err in errors)
+                {
+                    issues.Add(new ValidationIssue(this.Resource, ValidationStatus.Error, ValidationStatusCode.Error_General_ValidationError, err));
+                }
+                foreach (string warn in warnings)
+                {
+                    issues.Add(new ValidationIssue(this.Resource, ValidationStatus.Warning, ValidationStatusCode.Warning_General_ValidationWarning, warn));
+                }
 
-            //Put through ValidationResultSet to weed out redundant messages
-            var set = new ValidationResultSet(issues);
+                //Put through ValidationResultSet to weed out redundant messages
+                var set = new ValidationResultSet(issues);
 
-            try
-            {
-                var res = ResourceTypeRegistry.Deserialize(editor.XmlContent);
-                var context = new ResourceValidationContext(_edSvc.ResourceService, _edSvc.FeatureService);
-                //We don't care about dependents, we just want to validate *this* resource
-                var resIssues = ResourceValidatorSet.Validate(context, res, false);
-                set.AddIssues(resIssues);
-            }
-            catch 
-            { 
-                //This can fail because the XML may be for something that Maestro does not offer a strongly-typed class for yet.
-                //So the XML may be legit, just not for this version of Maestro that is doing the validating
-            }
+                try
+                {
+                    var res = ResourceTypeRegistry.Deserialize(editor.XmlContent);
+                    var context = new ResourceValidationContext(_edSvc.ResourceService, _edSvc.FeatureService);
+                    //We don't care about dependents, we just want to validate *this* resource
+                    var resIssues = ResourceValidatorSet.Validate(context, res, false);
+                    set.AddIssues(resIssues);
+                }
+                catch
+                {
+                    //This can fail because the XML may be for something that Maestro does not offer a strongly-typed class for yet.
+                    //So the XML may be legit, just not for this version of Maestro that is doing the validating
+                }
 
-            //Only care about errors. Warnings and other types should not derail us from saving
-            return set.GetAllIssues(ValidationStatus.Error);
+                //Only care about errors. Warnings and other types should not derail us from saving
+                return set.GetAllIssues(ValidationStatus.Error);
+            };
+
+            if (this.InvokeRequired)
+                return (ValidationIssue[])this.Invoke(validator);
+            else
+                return validator();
         }
 
         public override string GetXmlContent()

Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs	2012-06-05 14:52:05 UTC (rev 6734)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs	2012-06-06 11:38:16 UTC (rev 6735)
@@ -148,7 +148,7 @@
             set 
             {
                 _origText = null;            
-                txtXmlContent.Text = value; FormatText();
+                txtXmlContent.Text = value; //FormatText();
             }
         }
 



More information about the mapguide-commits mailing list