[mapguide-commits] r8154 - in trunk/Tools/Maestro/SDK: Samples/HelloAddIn Samples/QueryFeatureSource SamplesWeb/SamplesWeb/Tasks

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat May 24 03:12:31 PDT 2014


Author: jng
Date: 2014-05-24 03:12:31 -0700 (Sat, 24 May 2014)
New Revision: 8154

Modified:
   trunk/Tools/Maestro/SDK/Samples/HelloAddIn/Readme.txt
   trunk/Tools/Maestro/SDK/Samples/HelloAddIn/SidePanel.cs
   trunk/Tools/Maestro/SDK/Samples/QueryFeatureSource/Form1.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddThemedDistrictsLayer.aspx.cs
Log:
Fix and update Maestro SDK samples

Modified: trunk/Tools/Maestro/SDK/Samples/HelloAddIn/Readme.txt
===================================================================
--- trunk/Tools/Maestro/SDK/Samples/HelloAddIn/Readme.txt	2014-05-24 08:49:31 UTC (rev 8153)
+++ trunk/Tools/Maestro/SDK/Samples/HelloAddIn/Readme.txt	2014-05-24 10:12:31 UTC (rev 8154)
@@ -56,7 +56,7 @@
 
 Method #1 is okay as long as <your maestro directory> is not under Program Files as this directory is extremely locked down in Windows Vista and newer (due to UAC). If you installed Maestro via the Windows installer, then this is not a viable method of deployment. Uninstallation is a case of deleting this addin directory
 
-Method #2 is the preferred method as such addins will be installed to a safe location that is UAC compatible (addins are generally installed to: %APPDATA%\Maestro-5.0)
+Method #2 is the preferred method as such addins will be installed to a safe location that is UAC compatible (addins are generally installed to: %APPDATA%\Maestro-6.0)
 
 AddIn installations and uninstallations via Maestro's AddIn Manager require a restart to take effect
 

Modified: trunk/Tools/Maestro/SDK/Samples/HelloAddIn/SidePanel.cs
===================================================================
--- trunk/Tools/Maestro/SDK/Samples/HelloAddIn/SidePanel.cs	2014-05-24 08:49:31 UTC (rev 8153)
+++ trunk/Tools/Maestro/SDK/Samples/HelloAddIn/SidePanel.cs	2014-05-24 10:12:31 UTC (rev 8154)
@@ -33,13 +33,13 @@
         {
             base.OnLoad(e);
             _siteExplorer = Workbench.Instance.ActiveSiteExplorer;
-            _siteExplorer.ItemsSelected += new RepositoryItemEventHandler(OnItemsSelected);
+            _siteExplorer.ItemsSelected += OnItemsSelected;
             CheckButtonState(new RepositoryItem[0]);
         }
 
-        void OnItemsSelected(object sender, RepositoryItem[] items)
+        void OnItemsSelected(object sender, RepositoryItemEventArgs e)
         {
-            CheckButtonState(items);
+            CheckButtonState(e.Items);
         }
 
         private void CheckButtonState(RepositoryItem[] items)

Modified: trunk/Tools/Maestro/SDK/Samples/QueryFeatureSource/Form1.cs
===================================================================
--- trunk/Tools/Maestro/SDK/Samples/QueryFeatureSource/Form1.cs	2014-05-24 08:49:31 UTC (rev 8153)
+++ trunk/Tools/Maestro/SDK/Samples/QueryFeatureSource/Form1.cs	2014-05-24 10:12:31 UTC (rev 8154)
@@ -67,12 +67,18 @@
 
         private void btnClear_Click(object sender, EventArgs e)
         {
+            ClearGrid();
+        }
+
+        private void ClearGrid()
+        {
             grdResults.Rows.Clear();
             grdResults.Columns.Clear();
         }
 
         private void btnQuery_Click(object sender, EventArgs e)
         {
+            ClearGrid();
             //This method does the actual query
             IFeatureReader reader = null;
 

Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddThemedDistrictsLayer.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddThemedDistrictsLayer.aspx.cs	2014-05-24 08:49:31 UTC (rev 8153)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddThemedDistrictsLayer.aspx.cs	2014-05-24 10:12:31 UTC (rev 8154)
@@ -110,11 +110,20 @@
             //Set feature source
             vldf.ResourceId = resId;
 
-            //Set the feature class
-            vldf.FeatureName = "SDF_2_Schema:VotingDistricts";
+            //Set the feature class 
+            //
+            //Note: In versions of the Sheboygan Dataset before 2.6, this used to be
+            //
+            // - Feature Class: SDF_2_Schema:VotingDistricts
+            // - Identity Property: Autogenerated_SDF_ID
+            // - Geometry Property: Data
+            string featureClass = "Default:VotingDistricts";
+            string idProp = "FeatId";
+            string geometryProp = "Geometry";
+            vldf.FeatureName = featureClass;
 
             //Set the designated geometry
-            vldf.Geometry = "Data";
+            vldf.Geometry = geometryProp;
 
             //Get the first vector scale range. This will have been created for us and is 0 to infinity
             IVectorScaleRange vsr = vldf.GetScaleRangeAt(0);
@@ -136,9 +145,9 @@
             IFeatureService featSvc = conn.FeatureService;
             //Generate a random color for each distinct feature id
             //Perform a distinct value query
-            IReader valueReader = featSvc.AggregateQueryFeatureSource(resId, "SDF_2_Schema:VotingDistricts", null, new NameValueCollection()
+            IReader valueReader = featSvc.AggregateQueryFeatureSource(resId, featureClass, null, new NameValueCollection()
             {
-                { "Value", "UNIQUE(Autogenerated_SDF_ID)" } //UNIQUE() is the aggregate function that collects all distinct values of FeatId
+                { "Value", "UNIQUE(" + idProp + ")" } //UNIQUE() is the aggregate function that collects all distinct values of FeatId
             });
 
             while (valueReader.ReadNext())
@@ -146,7 +155,7 @@
                 //The parent Layer Definition provides all the methods needed to create the necessary child elements
                 IAreaRule rule = ldf.CreateDefaultAreaRule();
                 //Set the filter for this rule
-                rule.Filter = "Autogenerated_SDF_ID = " + valueReader["Value"].ToString();
+                rule.Filter = idProp + " = " + valueReader["Value"].ToString();
                 //IReader allows object access by name in case you don't care to determine the data type
                 rule.LegendLabel = valueReader["Value"].ToString();
                 //Assign a random color fill



More information about the mapguide-commits mailing list