[mapguide-commits] r5979 - in trunk/Tools/Maestro: Maestro.Base/UI Maestro.Editors/LayerDefinition

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 6 12:56:31 EDT 2011


Author: jng
Date: 2011-07-06 09:56:31 -0700 (Wed, 06 Jul 2011)
New Revision: 5979

Modified:
   trunk/Tools/Maestro/Maestro.Base/UI/NewResourceDialog.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
Log:
Mono-related fixes and workarounds.


Modified: trunk/Tools/Maestro/Maestro.Base/UI/NewResourceDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/NewResourceDialog.cs	2011-07-06 14:25:21 UTC (rev 5978)
+++ trunk/Tools/Maestro/Maestro.Base/UI/NewResourceDialog.cs	2011-07-06 16:56:31 UTC (rev 5979)
@@ -28,9 +28,13 @@
 using OSGeo.MapGuide.MaestroAPI.Services;
 using Maestro.Base.Services;
 using Maestro.Base.Templates;
+using OSGeo.MapGuide.MaestroAPI;
+using System.Threading;
 
 namespace Maestro.Base.UI
 {
+    //FIXME: Exceptions thrown in Mono centered around a non-existent image
+
     public partial class NewResourceDialog : Form
     {
         private static bool _subsequentRun = false;
@@ -57,29 +61,39 @@
         {
             lstCategories.DataSource = _nits.GetCategories();
 
-            if (_subsequentRun)
+            if (Platform.IsRunningOnMono)
             {
-                if (_lastSelectedCategoies.Count > 0)
+                //Sorry, you mono users will have to manually select
+                //the other categories due to dodgy ImageList/ListView
+                //implementation
+                lstCategories.SetSelected(0, true);
+            }
+            else
+            {
+                if (_subsequentRun)
                 {
-                    foreach (var cat in _lastSelectedCategoies)
+                    if (_lastSelectedCategoies.Count > 0)
                     {
-                        var idx = lstCategories.Items.IndexOf(cat);
-                        if (idx >= 0)
+                        foreach (var cat in _lastSelectedCategoies)
                         {
-                            lstCategories.SetSelected(idx, true);
+                            var idx = lstCategories.Items.IndexOf(cat);
+                            if (idx >= 0)
+                            {
+                                lstCategories.SetSelected(idx, true);
+                            }
                         }
                     }
                 }
-            }
-            else
-            {
-                //First run, select all categories
-                foreach (var cat in _nits.GetCategories())
+                else
                 {
-                    var idx = lstCategories.Items.IndexOf(cat);
-                    if (idx >= 0)
+                    //First run, select all categories
+                    foreach (var cat in _nits.GetCategories())
                     {
-                        lstCategories.SetSelected(idx, true);
+                        var idx = lstCategories.Items.IndexOf(cat);
+                        if (idx >= 0)
+                        {
+                            lstCategories.SetSelected(idx, true);
+                        }
                     }
                 }
             }
@@ -125,6 +139,10 @@
             lstTemplates.Clear();
             tplImgList.Images.Clear();
             lstTemplates.Groups.Clear();
+
+            lstTemplates.SmallImageList = tplImgList;
+            lstTemplates.LargeImageList = tplImgList;
+
             Dictionary<string, ListViewGroup> groups = new Dictionary<string, ListViewGroup>();
             foreach (var cat in templSet.GetCategories())
             {
@@ -162,8 +180,7 @@
 
                     lstTemplates.Items.Add(li);
                 }
-                lstTemplates.SmallImageList = tplImgList;
-                lstTemplates.LargeImageList = tplImgList;
+                
             }
         }
 

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs	2011-07-06 14:25:21 UTC (rev 5978)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs	2011-07-06 16:56:31 UTC (rev 5979)
@@ -72,7 +72,9 @@
 
         internal void PopulatePropertyList()
         {
-            if (string.IsNullOrEmpty(_vl.FeatureName))
+            //NOTE: This is being called before _vl is assigned in mono
+            //so guard against it
+            if (_vl == null || string.IsNullOrEmpty(_vl.FeatureName))
                 return;
 
             //TODO: Should just fetch the class definition



More information about the mapguide-commits mailing list