[mapguide-commits] r5762 - in trunk/Tools/Maestro/SDK: . SamplesWeb SamplesWeb/SamplesWeb SamplesWeb/SamplesWeb/Properties SamplesWeb/SamplesWeb/Tasks

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun May 8 13:25:00 EDT 2011


Author: jng
Date: 2011-05-08 10:25:00 -0700 (Sun, 08 May 2011)
New Revision: 5762

Added:
   trunk/Tools/Maestro/SDK/SamplesWeb/
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb.sln
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.designer.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Properties/
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Properties/AssemblyInfo.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.designer.cs
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Web.config
   trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/readme.txt
Log:
#1676: First cut of web-based samples using the Maestro API. It currently only has one sample (Toggle Parcels Layer). Due to #1681, the re-toggled layer currently is always at the bottom of the draw order.


Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SamplesWeb._Default" %>

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,70 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.ObjectModels.WebLayout;
+using OSGeo.MapGuide.ObjectModels;
+
+namespace SamplesWeb
+{
+    public partial class _Default : System.Web.UI.Page
+    {
+        protected void Page_Load(object sender, EventArgs e)
+        {
+            string agent = ConfigurationManager.AppSettings["MapAgentUrl"];
+            
+            IServerConnection conn = ConnectionProviderRegistry.CreateConnection(
+                "Maestro.Http",
+                "Url", agent,
+                "Username", "Anonymous",
+                "Password", "");
+
+            var mdfId = "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition";
+            if (conn.ResourceService.ResourceExists(mdfId))
+            {
+                //Create a WebLayout. By default the version created will be 
+                //the latest supported one on the mapguide server we've connected to. For example
+                //connecting to MGOS 2.2 will create a version 1.1.0 WebLayout. All the known
+                //resource versions have been registered on startup (see Global.asax.cs)
+                IWebLayout wl = ObjectFactory.CreateWebLayout(conn, mdfId);
+                wl.TaskPane.InitialTask = "../SamplesWeb/Tasks/Home.aspx";
+
+                string resId = "Session:" + conn.SessionID + "//Sheboygan.WebLayout";
+                conn.ResourceService.SaveResourceAs(wl, resId);
+
+                Response.Redirect("../mapviewernet/ajaxviewer.aspx?WEBLAYOUT=" + resId + "&SESSION=" + conn.SessionID);
+            }
+            else
+            {
+                Response.Write("Could not find map definition: " + mdfId + "<br/>");
+                Response.Write("Please ensure the Sheboygan sample dataset has been loaded");
+            }
+        }
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.designer.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Default.aspx.designer.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.4952
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SamplesWeb {
+    
+    
+    public partial class _Default {
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1 @@
+<%@ Application Codebehind="Global.asax.cs" Inherits="SamplesWeb.Global" Language="C#" %>

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Global.asax.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,148 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.SessionState;
+using OSGeo.MapGuide.ObjectModels;
+
+using Ldf110 = OSGeo.MapGuide.ObjectModels.LayerDefinition_1_1_0;
+using Ldf120 = OSGeo.MapGuide.ObjectModels.LayerDefinition_1_2_0;
+using Ldf130 = OSGeo.MapGuide.ObjectModels.LayerDefinition_1_3_0;
+
+using Lp110 = OSGeo.MapGuide.ObjectModels.LoadProcedure_1_1_0;
+using Lp220 = OSGeo.MapGuide.ObjectModels.LoadProcedure_2_2_0;
+using WL110 = OSGeo.MapGuide.ObjectModels.WebLayout_1_1_0;
+
+using Sym110 = OSGeo.MapGuide.ObjectModels.SymbolDefinition_1_1_0;
+
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+using OSGeo.MapGuide.MaestroAPI.Resource.Validation;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+
+namespace SamplesWeb
+{
+    public class Global : System.Web.HttpApplication
+    {
+
+        protected void Application_Start(object sender, EventArgs e)
+        {
+            //By default the ObjectFactory, ResourceTypeRegistry and ResourceValidatorSet only
+            //support v1.0.0 of all resource types. To support additional types we need to inject
+            //this information as part of the consuming application's init/startup process
+            //
+            //This is our application's entry point, so we do this here.
+            //
+            //This is only necessary if you want to create resources newer than version 1.0.0
+
+            //Layer Definition 1.1.0
+            ResourceValidatorSet.RegisterValidator(new Ldf110.LayerDefinitionValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.LayerDefinition, "1.1.0"),
+                new ResourceSerializationCallback(Ldf110.LdfEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Ldf110.LdfEntryPoint.Deserialize));
+            ObjectFactory.RegisterLayerFactoryMethod(new Version(1, 1, 0), new LayerCreatorFunc(Ldf110.LdfEntryPoint.CreateDefault));
+
+            //Layer Definition 1.2.0
+            ResourceValidatorSet.RegisterValidator(new Ldf120.LayerDefinitionValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.LayerDefinition, "1.2.0"),
+                new ResourceSerializationCallback(Ldf120.LdfEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Ldf120.LdfEntryPoint.Deserialize));
+            ObjectFactory.RegisterLayerFactoryMethod(new Version(1, 2, 0), new LayerCreatorFunc(Ldf120.LdfEntryPoint.CreateDefault));
+
+            //Layer Definition 1.3.0
+            ResourceValidatorSet.RegisterValidator(new Ldf130.LayerDefinitionValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.LayerDefinition, "1.3.0"),
+                new ResourceSerializationCallback(Ldf130.LdfEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Ldf130.LdfEntryPoint.Deserialize));
+            ObjectFactory.RegisterLayerFactoryMethod(new Version(1, 3, 0), new LayerCreatorFunc(Ldf130.LdfEntryPoint.CreateDefault));
+
+            //Load Procedure 1.1.0
+            ResourceValidatorSet.RegisterValidator(new Lp110.LoadProcedureValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.LoadProcedure, "1.1.0"),
+                new ResourceSerializationCallback(Lp110.LoadProcEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Lp110.LoadProcEntryPoint.Deserialize));
+
+            //Load Procedure 1.1.0 schema offers nothing new for the ones we want to support, so nothing to register
+            //with the ObjectFactory
+
+            //Load Procedure 2.2.0
+            ResourceValidatorSet.RegisterValidator(new Lp220.LoadProcedureValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.LoadProcedure, "2.2.0"),
+                new ResourceSerializationCallback(Lp220.LoadProcEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Lp220.LoadProcEntryPoint.Deserialize));
+            ObjectFactory.RegisterLoadProcedureFactoryMethod(LoadType.Sqlite, new LoadProcCreatorFunc(Lp220.LoadProcEntryPoint.CreateDefaultSqlite));
+
+            //Web Layout 1.1.0
+            ResourceValidatorSet.RegisterValidator(new WL110.WebLayoutValidator());
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.WebLayout, "1.1.0"),
+                new ResourceSerializationCallback(WL110.WebLayoutEntryPoint.Serialize),
+                new ResourceDeserializationCallback(WL110.WebLayoutEntryPoint.Deserialize));
+            ObjectFactory.RegisterWebLayoutFactoryMethod(new Version(1, 1, 0), new WebLayoutCreatorFunc(WL110.WebLayoutEntryPoint.CreateDefault));
+
+            //Symbol Definition 1.1.0
+            ResourceTypeRegistry.RegisterResource(
+                new ResourceTypeDescriptor(ResourceTypes.SymbolDefinition, "1.1.0"),
+                new ResourceSerializationCallback(Sym110.SymbolDefEntryPoint.Serialize),
+                new ResourceDeserializationCallback(Sym110.SymbolDefEntryPoint.Deserialize));
+            ObjectFactory.RegisterCompoundSymbolFactoryMethod(new Version(1, 1, 0), new CompoundSymbolDefCreatorFunc(Sym110.SymbolDefEntryPoint.CreateDefaultCompound));
+            ObjectFactory.RegisterSimpleSymbolFactoryMethod(new Version(1, 1, 0), new SimpleSymbolDefCreatorFunc(Sym110.SymbolDefEntryPoint.CreateDefaultSimple));
+        }
+
+        protected void Session_Start(object sender, EventArgs e)
+        {
+
+        }
+
+        protected void Application_BeginRequest(object sender, EventArgs e)
+        {
+
+        }
+
+        protected void Application_AuthenticateRequest(object sender, EventArgs e)
+        {
+
+        }
+
+        protected void Application_Error(object sender, EventArgs e)
+        {
+
+        }
+
+        protected void Session_End(object sender, EventArgs e)
+        {
+
+        }
+
+        protected void Application_End(object sender, EventArgs e)
+        {
+
+        }
+    }
+}
\ No newline at end of file

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Properties/AssemblyInfo.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Properties/AssemblyInfo.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SamplesWeb")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SamplesWeb")]
+[assembly: AssemblyCopyright("Copyright ©  2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,147 @@
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SamplesWeb</RootNamespace>
+    <AssemblyName>SamplesWeb</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="OSGeo.MapGuide.MaestroAPI, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.MaestroAPI.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.LayerDefinition-1.1.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.LayerDefinition-1.2.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.2.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.LayerDefinition-1.3.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.3.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.SymbolDefinition-1.1.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.SymbolDefinition-1.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0, Version=3.0.0.5728, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\bin\OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Web.Mobile" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="..\..\bin\ConnectionProviders.xml">
+      <Link>ConnectionProviders.xml</Link>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\bin\OSGeo.MapGuide.MaestroAPI.Http.dll">
+      <Link>OSGeo.MapGuide.MaestroAPI.Http.dll</Link>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Default.aspx" />
+    <Content Include="Global.asax" />
+    <Content Include="readme.txt" />
+    <Content Include="Tasks\ToggleParcelsLayer.aspx" />
+    <Content Include="Tasks\Home.aspx" />
+    <Content Include="Web.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Default.aspx.cs">
+      <SubType>ASPXCodeBehind</SubType>
+      <DependentUpon>Default.aspx</DependentUpon>
+    </Compile>
+    <Compile Include="Default.aspx.designer.cs">
+      <DependentUpon>Default.aspx</DependentUpon>
+    </Compile>
+    <Compile Include="Global.asax.cs">
+      <DependentUpon>Global.asax</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Tasks\ToggleParcelsLayer.aspx.cs">
+      <DependentUpon>ToggleParcelsLayer.aspx</DependentUpon>
+      <SubType>ASPXCodeBehind</SubType>
+    </Compile>
+    <Compile Include="Tasks\ToggleParcelsLayer.aspx.designer.cs">
+      <DependentUpon>ToggleParcelsLayer.aspx</DependentUpon>
+    </Compile>
+    <Compile Include="Tasks\Home.aspx.cs">
+      <DependentUpon>Home.aspx</DependentUpon>
+      <SubType>ASPXCodeBehind</SubType>
+    </Compile>
+    <Compile Include="Tasks\Home.aspx.designer.cs">
+      <DependentUpon>Home.aspx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="App_Data\" />
+    <Folder Include="bin\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+        <WebProjectProperties>
+          <UseIIS>False</UseIIS>
+          <AutoAssignPort>True</AutoAssignPort>
+          <DevelopmentServerPort>49241</DevelopmentServerPort>
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
+          <IISUrl>
+          </IISUrl>
+          <NTLMAuthentication>False</NTLMAuthentication>
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+        </WebProjectProperties>
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,17 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="SamplesWeb.Tasks.Home" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+    <title>Home</title>
+</head>
+<body>
+    <p>At any time, click the <strong>home button</strong> in the task bar to return to this list of samples.</p>
+    
+    <p>Samples</p>
+    <ul>
+        <li><a href="ToggleParcelsLayer.aspx?SESSION=<%=Request.Params["SESSION"] %>&MAPNAME=<%=Request.Params["MAPNAME"] %>">Toggle Parcels Layer</a></li>
+    </ul>
+</body>
+</html>

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,40 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+
+namespace SamplesWeb.Tasks
+{
+    public partial class Home : System.Web.UI.Page
+    {
+        protected void Page_Load(object sender, EventArgs e)
+        {
+            
+        }
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.4952
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SamplesWeb.Tasks {
+    
+    
+    public partial class Home {
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,18 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ToggleParcelsLayer.aspx.cs" Inherits="SamplesWeb.Tasks.ToggleParcelsLayer" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+    <title>Untitled Page</title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+        <asp:Label ID="lblMessage" runat="server"></asp:Label>
+        <br />
+        <a href="javascript:history.go(-1)">Go back</a>
+    </div>
+    </form>
+</body>
+</html>

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,103 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.MaestroAPI.Mapping;
+
+namespace SamplesWeb.Tasks
+{
+    public partial class ToggleParcelsLayer : System.Web.UI.Page
+    {
+        protected void Page_Load(object sender, EventArgs e)
+        {
+            string agent = ConfigurationManager.AppSettings["MapAgentUrl"];
+
+            IServerConnection conn = ConnectionProviderRegistry.CreateConnection(
+                "Maestro.Http",
+                "Url", agent,
+                "SessionId", Request.Params["SESSION"]);
+
+            IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+            string rtMapId = "Session:" + conn.SessionID + "//" + Request.Params["MAPNAME"] + ".Map";
+
+            RuntimeMap rtMap = mpSvc.OpenMap(rtMapId);
+
+            RuntimeMapLayer parcels = rtMap.GetLayerByName("Parcels");
+            if (parcels != null)
+            {
+                rtMap.RemoveLayer(parcels);
+
+                rtMap.Save();
+
+                Page.ClientScript.RegisterStartupScript(
+                    this.GetType(),
+                    "load",
+                    "<script type=\"text/javascript\"> window.onload = function() { parent.parent.Refresh(); } </script>");
+
+                lblMessage.Text = "Parcels layer removed";
+            }
+            else
+            {
+                RuntimeMapGroup group = rtMap.GetGroupByName("Municipal");
+                if (group == null)
+                {
+                    group = rtMap.AddGroup("Municipal");
+                    throw new Exception("Layer group not found");
+                }
+
+                RuntimeMapLayer layer = rtMap.AddLayer("Library://Samples/Sheboygan/Layers/Parcels.LayerDefinition", group);
+
+                layer.LegendLabel = "Parcels";
+                layer.ShowInLegend = true;
+                layer.ExpandInLegend = true;
+                layer.Selectable = true;
+                layer.Visible = true;
+
+                //Set it to be drawn above islands.
+                //In terms of draw order, it goes [0...n] -> [TopMost ... Bottom]
+                //So for a layer to be drawn above something else, its draw order must be
+                //less than that particular layer.
+
+                //FIXME: trac #1681
+                RuntimeMapLayer islands = rtMap.GetLayerByName("Islands");
+                layer.SetDrawOrder(islands.DisplayOrder - 0.0000001);
+
+                rtMap.Save();
+
+                Page.ClientScript.RegisterStartupScript(
+                    this.GetType(),
+                    "load",
+                    "<script type=\"text/javascript\"> window.onload = function() { parent.parent.Refresh(); } </script>");
+
+                lblMessage.Text = "Parcels layer added again";
+            }
+        }
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.designer.cs	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx.designer.cs	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.4952
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SamplesWeb.Tasks {
+    
+    
+    public partial class ToggleParcelsLayer {
+        
+        /// <summary>
+        /// form1 control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+        
+        /// <summary>
+        /// lblMessage control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Label lblMessage;
+    }
+}

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Web.config
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Web.config	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Web.config	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<configuration>
+
+    <appSettings>
+        <add key="MapAgentUrl" value="http://localhost/mapguide/mapagent/mapagent.fcgi"/>
+    </appSettings>
+    <connectionStrings/>
+  
+    <system.web>
+        <!-- 
+            Set compilation debug="true" to insert debugging 
+            symbols into the compiled page. Because this 
+            affects performance, set this value to true only 
+            during development.
+        -->
+        <compilation debug="false">
+
+        </compilation>
+        <!--
+            The <authentication> section enables configuration 
+            of the security authentication mode used by 
+            ASP.NET to identify an incoming user. 
+        -->
+        <authentication mode="Windows" />
+        <!--
+            The <customErrors> section enables configuration 
+            of what to do if/when an unhandled error occurs 
+            during the execution of a request. Specifically, 
+            it enables developers to configure html error pages 
+            to be displayed in place of a error stack trace.
+
+        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+            <error statusCode="403" redirect="NoAccess.htm" />
+            <error statusCode="404" redirect="FileNotFound.htm" />
+        </customErrors>
+        -->
+
+    </system.web>
+
+</configuration>

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/readme.txt
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/readme.txt	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/readme.txt	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,8 @@
+Setup Instructions
+------------------
+
+In IIS, create a virtual directory named "SamplesWeb" as a child under the main mapguide virtual directory.
+
+Set the default page to Default.aspx
+
+This sample requires the Sheboygan sample dataset. The sample will check if this dataset exists on startup.
\ No newline at end of file

Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb.sln
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb.sln	                        (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb.sln	2011-05-08 17:25:00 UTC (rev 5762)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplesWeb", "SamplesWeb\SamplesWeb.csproj", "{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{28A017F3-28C9-4C0F-BD7F-160DC4D1EB44}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal



More information about the mapguide-commits mailing list