[mapguide-commits] r5415 - in sandbox/maestro-3.0: Maestro Maestro.Base Maestro.Base/Editor Maestro.Base/Templates Maestro.Editors Maestro.Editors/Common Maestro.Editors/Fusion Maestro.Packaging MaestroAPITestRunner MaestroAPITests MaestroFsPreview OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Commands OSGeo.MapGuide.MaestroAPI/Expression OSGeo.MapGuide.MaestroAPI/Feature OSGeo.MapGuide.MaestroAPI/IO OSGeo.MapGuide.MaestroAPI/Mapping OSGeo.MapGuide.MaestroAPI/ObjectModels OSGeo.MapGuide.MaestroAPI/Resource OSGeo.MapGuide.MaestroAPI/Resource/Validation OSGeo.MapGuide.MaestroAPI/Services OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.MaestroAPI.Native

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 30 03:21:58 EST 2010


Author: jng
Date: 2010-11-30 00:21:57 -0800 (Tue, 30 Nov 2010)
New Revision: 5415

Added:
   sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.Designer.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.resx
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.resx
   sandbox/maestro-3.0/Maestro/Maestro_All.sln
   sandbox/maestro-3.0/MaestroAPITestRunner/App.config
   sandbox/maestro-3.0/MaestroAPITestRunner/ConnectionProviders.xml
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IO/ReadOnlyRewindableStream.cs
Removed:
   sandbox/maestro-3.0/MaestroAPITests/App.config
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/IDynamicInvokable.cs
Modified:
   sandbox/maestro-3.0/Maestro.Base/Editor/IEditorFactory.cs
   sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
   sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
   sandbox/maestro-3.0/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourceDataCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx
   sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.resx
   sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
   sandbox/maestro-3.0/Maestro.Packaging/PackageBuilder.cs
   sandbox/maestro-3.0/Maestro/
   sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj
   sandbox/maestro-3.0/MaestroAPITests/MaestroAPITests.csproj
   sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs
   sandbox/maestro-3.0/MaestroFsPreview/MaestroFsPreview.csproj
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureSetReader.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/OSGeo.MapGuide.MaestroAPI.Native.csproj
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Expression/FdoFunctionNamespace.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Feature/FeatureSetReader.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Utility.cs
Log:
This submission includes the following changes:
 - Submit current work on Fusion Editor.
 - Move app.config form Unit Test library to Test Runner
 - Add an experimental System.IO.Stream wrapper around MgByteReader. This is to remove the overhead of needing to fully copy the contents of the underlying MgByteReader to a fully managed stream and at the same time workaround the issue of invalidation when passed as a parameter. However, MgByteStream to Stream conversion is still the method being used as I am still yet to fully setup the required libraries to fully profile performance for the native implementation.
 - Add a performance unit test for RuntimeMap, testing runtime map creation on a 200 layer, 50 group map definition.
 - Remove the IDynamicInvokable interface, as supported interface testing is already good enough approach for the pending resource upgrade feature


Property changes on: sandbox/maestro-3.0/Maestro
___________________________________________________________________
Modified: svn:ignore
   - Maestro.suo
obj
*.user
*.cache

   + Maestro.suo
obj
*.user
*.cache
*.suo


Added: sandbox/maestro-3.0/Maestro/Maestro_All.sln
===================================================================
--- sandbox/maestro-3.0/Maestro/Maestro_All.sln	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro/Maestro_All.sln	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,158 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C# Express 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro", "Maestro.csproj", "{E0C36475-2B70-4F6D-ACE0-8943167806DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\Thirdparty\SharpDevelop\ICSharpCode.Core\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "..\Thirdparty\SharpDevelop\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.Base", "..\Maestro.Base\Maestro.Base.csproj", "{F1E2F468-5030-4DBA-968C-9620284AFAA1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaestroBaseTests", "..\MaestroBaseTests\MaestroBaseTests.csproj", "{CE5F281C-0162-4832-87BB-A677D13D116F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaestroFsPreview", "..\MaestroFsPreview\MaestroFsPreview.csproj", "{59BE5E18-17B6-431D-836E-C0AABA6D69E8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.AddIn.ExtendedObjectModels", "..\Maestro.AddIn.ExtendedObjectModels\Maestro.AddIn.ExtendedObjectModels.csproj", "{32BA7DF6-1AFA-441D-9231-5624C5920706}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgCooker", "..\MgCooker\MgCooker.csproj", "{C7DCF771-5982-4859-A17F-01126E6F9BA6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgCooker.Cmd", "..\MgCooker.Cmd\MgCooker.Cmd.csproj", "{0FD82B7B-1264-410F-86D1-47E9CCACD68E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.Editors", "..\Maestro.Editors\Maestro.Editors.csproj", "{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.Login", "..\Maestro.Login\Maestro.Login.csproj", "{07588440-5F9F-4C30-AA06-9CF30BA6DDE6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.Packaging", "..\Maestro.Packaging\Maestro.Packaging.csproj", "{0EA33E36-9C33-4D60-B378-B87FADAA0F40}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.Shared.UI", "..\Maestro.Shared.UI\Maestro.Shared.UI.csproj", "{CFD19053-2172-41D3-8460-0FD2123A1E88}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.MaestroAPI", "..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj", "{80FA3158-8B5F-48D1-A393-0378AFE48A7E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.MaestroAPI.Http", "..\OSGeo.MapGuide.MaestroAPI.Http\OSGeo.MapGuide.MaestroAPI.Http.csproj", "{6EF1E775-444B-4E5F-87FB-D687C43A68D7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.MaestroAPI.Native", "..\OSGeo.MapGuide.MaestroAPI.Native\OSGeo.MapGuide.MaestroAPI.Native.csproj", "{F4420153-9DF3-4407-AD65-E8ABED2B6E25}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.LayerDefinition-1.1.0", "..\ExtendedModels\LayerDefinition-1.1.0\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.1.0.csproj", "{B5EA049C-6AB7-4686-A2F4-4BA2EAC0E585}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.LayerDefinition-1.2.0", "..\ExtendedModels\LayerDefinition-1.2.0\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.2.0.csproj", "{EDDB0F74-6FE7-4969-80B0-817A629722CD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.LayerDefinition-1.3.0", "..\ExtendedModels\LayerDefinition-1.3.0\OSGeo.MapGuide.ObjectModels.LayerDefinition-1.3.0.csproj", "{AC5068F6-CFBE-4BCD-B68B-062725E424D4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0", "..\ExtendedModels\LoadProcedure-1.1.0\OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.csproj", "{B2A1F69E-52AA-42A2-8DED-89ADB9B14A38}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0", "..\ExtendedModels\LoadProcedure-2.2.0\OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.csproj", "{D525B343-66D6-4D6B-9A55-78A173D94A51}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.SymbolDefinition-1.1.0", "..\ExtendedModels\SymbolDefinition-1.1.0\OSGeo.MapGuide.ObjectModels.SymbolDefinition-1.1.0.csproj", "{BF6E996E-27AF-44CD-B3CF-A40874E15B2E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0", "..\ExtendedModels\WebLayout-1.1.0\OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0.csproj", "{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "..\Thirdparty\TreeViewAdv\Aga.Controls\Aga.Controls.csproj", "{E73BB233-D88B-44A7-A98F-D71EE158381D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E0C36475-2B70-4F6D-ACE0-8943167806DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E0C36475-2B70-4F6D-ACE0-8943167806DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E0C36475-2B70-4F6D-ACE0-8943167806DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E0C36475-2B70-4F6D-ACE0-8943167806DC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F1E2F468-5030-4DBA-968C-9620284AFAA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F1E2F468-5030-4DBA-968C-9620284AFAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F1E2F468-5030-4DBA-968C-9620284AFAA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F1E2F468-5030-4DBA-968C-9620284AFAA1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CE5F281C-0162-4832-87BB-A677D13D116F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CE5F281C-0162-4832-87BB-A677D13D116F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CE5F281C-0162-4832-87BB-A677D13D116F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CE5F281C-0162-4832-87BB-A677D13D116F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{59BE5E18-17B6-431D-836E-C0AABA6D69E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{59BE5E18-17B6-431D-836E-C0AABA6D69E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{59BE5E18-17B6-431D-836E-C0AABA6D69E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{59BE5E18-17B6-431D-836E-C0AABA6D69E8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{32BA7DF6-1AFA-441D-9231-5624C5920706}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{32BA7DF6-1AFA-441D-9231-5624C5920706}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{32BA7DF6-1AFA-441D-9231-5624C5920706}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{32BA7DF6-1AFA-441D-9231-5624C5920706}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C7DCF771-5982-4859-A17F-01126E6F9BA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C7DCF771-5982-4859-A17F-01126E6F9BA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C7DCF771-5982-4859-A17F-01126E6F9BA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C7DCF771-5982-4859-A17F-01126E6F9BA6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}.Release|Any CPU.Build.0 = Release|Any CPU
+		{07588440-5F9F-4C30-AA06-9CF30BA6DDE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{07588440-5F9F-4C30-AA06-9CF30BA6DDE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{07588440-5F9F-4C30-AA06-9CF30BA6DDE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{07588440-5F9F-4C30-AA06-9CF30BA6DDE6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0EA33E36-9C33-4D60-B378-B87FADAA0F40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0EA33E36-9C33-4D60-B378-B87FADAA0F40}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0EA33E36-9C33-4D60-B378-B87FADAA0F40}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0EA33E36-9C33-4D60-B378-B87FADAA0F40}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CFD19053-2172-41D3-8460-0FD2123A1E88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CFD19053-2172-41D3-8460-0FD2123A1E88}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CFD19053-2172-41D3-8460-0FD2123A1E88}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CFD19053-2172-41D3-8460-0FD2123A1E88}.Release|Any CPU.Build.0 = Release|Any CPU
+		{80FA3158-8B5F-48D1-A393-0378AFE48A7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{80FA3158-8B5F-48D1-A393-0378AFE48A7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{80FA3158-8B5F-48D1-A393-0378AFE48A7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{80FA3158-8B5F-48D1-A393-0378AFE48A7E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6EF1E775-444B-4E5F-87FB-D687C43A68D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6EF1E775-444B-4E5F-87FB-D687C43A68D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6EF1E775-444B-4E5F-87FB-D687C43A68D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6EF1E775-444B-4E5F-87FB-D687C43A68D7}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F4420153-9DF3-4407-AD65-E8ABED2B6E25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F4420153-9DF3-4407-AD65-E8ABED2B6E25}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F4420153-9DF3-4407-AD65-E8ABED2B6E25}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F4420153-9DF3-4407-AD65-E8ABED2B6E25}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B5EA049C-6AB7-4686-A2F4-4BA2EAC0E585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B5EA049C-6AB7-4686-A2F4-4BA2EAC0E585}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B5EA049C-6AB7-4686-A2F4-4BA2EAC0E585}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B5EA049C-6AB7-4686-A2F4-4BA2EAC0E585}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EDDB0F74-6FE7-4969-80B0-817A629722CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EDDB0F74-6FE7-4969-80B0-817A629722CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EDDB0F74-6FE7-4969-80B0-817A629722CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EDDB0F74-6FE7-4969-80B0-817A629722CD}.Release|Any CPU.Build.0 = Release|Any CPU
+		{AC5068F6-CFBE-4BCD-B68B-062725E424D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{AC5068F6-CFBE-4BCD-B68B-062725E424D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{AC5068F6-CFBE-4BCD-B68B-062725E424D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{AC5068F6-CFBE-4BCD-B68B-062725E424D4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B2A1F69E-52AA-42A2-8DED-89ADB9B14A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B2A1F69E-52AA-42A2-8DED-89ADB9B14A38}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B2A1F69E-52AA-42A2-8DED-89ADB9B14A38}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B2A1F69E-52AA-42A2-8DED-89ADB9B14A38}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D525B343-66D6-4D6B-9A55-78A173D94A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D525B343-66D6-4D6B-9A55-78A173D94A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D525B343-66D6-4D6B-9A55-78A173D94A51}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D525B343-66D6-4D6B-9A55-78A173D94A51}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BF6E996E-27AF-44CD-B3CF-A40874E15B2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BF6E996E-27AF-44CD-B3CF-A40874E15B2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BF6E996E-27AF-44CD-B3CF-A40874E15B2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BF6E996E-27AF-44CD-B3CF-A40874E15B2E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.Designer.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,62 @@
+namespace Maestro.Base.Editor
+{
+    partial class FusionEditor
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.flexEditor = new Maestro.Editors.Fusion.FlexibleLayoutEditor();
+            this.panelBody.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // panelBody
+            // 
+            this.panelBody.Controls.Add(this.flexEditor);
+            // 
+            // flexEditor
+            // 
+            this.flexEditor.AutoScroll = true;
+            this.flexEditor.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.flexEditor.Location = new System.Drawing.Point(0, 0);
+            this.flexEditor.Name = "flexEditor";
+            this.flexEditor.Size = new System.Drawing.Size(614, 520);
+            this.flexEditor.TabIndex = 0;
+            // 
+            // FusionEditor
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Name = "FusionEditor";
+            this.panelBody.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private Maestro.Editors.Fusion.FlexibleLayoutEditor flexEditor;
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,51 @@
+#region Disclaimer / License
+// Copyright (C) 2010, 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.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using Maestro.Editors;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Editors.Fusion;
+
+namespace Maestro.Base.Editor
+{
+    public partial class FusionEditor: EditorContentBase
+    {
+        public FusionEditor()
+        {
+            InitializeComponent();
+        }
+
+        private IResource _res;
+        private IEditorService _edsvc;
+
+        protected override void Bind(IEditorService service)
+        {
+            _edsvc = service;
+            _res = _edsvc.GetEditedResource();
+
+            flexEditor.Bind(service);
+        }
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.resx	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/FusionEditor.resx	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Base/Editor/IEditorFactory.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/IEditorFactory.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/IEditorFactory.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -38,6 +38,21 @@
         IEditorViewContent Create();
     }
 
+    internal class FusionEditorFactory : IEditorFactory
+    {
+        public ResourceTypeDescriptor ResourceTypeAndVersion { get; private set; }
+
+        public FusionEditorFactory()
+        {
+            this.ResourceTypeAndVersion = new ResourceTypeDescriptor(OSGeo.MapGuide.MaestroAPI.ResourceTypes.ApplicationDefinition, "1.0.0");
+        }
+
+        public IEditorViewContent Create()
+        {
+            return new FusionEditor();
+        }
+    }
+
     internal class DrawingSourceEditorFactory : IEditorFactory
     {
         public ResourceTypeDescriptor ResourceTypeAndVersion { get; private set; }

Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin	2010-11-30 08:21:57 UTC (rev 5415)
@@ -39,6 +39,7 @@
     
     <!-- Registered editors -->
     <Path name="/Maestro/Editors">
+        <Class id="FusionEditor100" class="Maestro.Base.Editor.FusionEditorFactory" />
         <Class id="DrawingSourceEditor100" class="Maestro.Base.Editor.DrawingSourceEditorFactory" />
         <Class id="FeatureSourceEditor100" class="Maestro.Base.Editor.FeatureSourceEditorFactory" />
         <Class id="LayerDefinitionEditor100" class="Maestro.Base.Editor.LayerDefinitionEditorFactory" />

Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -143,6 +143,12 @@
     <Compile Include="Editor\FsEditorOptionPanel.Designer.cs">
       <DependentUpon>FsEditorOptionPanel.cs</DependentUpon>
     </Compile>
+    <Compile Include="Editor\FusionEditor.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Editor\FusionEditor.Designer.cs">
+      <DependentUpon>FusionEditor.cs</DependentUpon>
+    </Compile>
     <Compile Include="Editor\IEditorFactory.cs" />
     <Compile Include="Editor\IEditorViewContent.cs" />
     <Compile Include="Editor\LayerDefinitionEditor.cs">
@@ -409,6 +415,9 @@
     <EmbeddedResource Include="Editor\FsEditorOptionPanel.resx">
       <DependentUpon>FsEditorOptionPanel.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Editor\FusionEditor.resx">
+      <DependentUpon>FusionEditor.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Editor\LayerDefinitionEditor.resx">
       <DependentUpon>LayerDefinitionEditor.cs</DependentUpon>
     </EmbeddedResource>

Modified: sandbox/maestro-3.0/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -26,6 +26,7 @@
 using OSGeo.MapGuide.ObjectModels;
 using OSGeo.MapGuide.MaestroAPI.Resource;
 using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+using Maestro.Editors.Generic;
 
 namespace Maestro.Base.Templates
 {
@@ -50,7 +51,20 @@
 
         public override IResource CreateItem(IServerConnection conn)
         {
-            return ObjectFactory.CreateFlexibleLayout(conn, FusionTemplateNames.Slate);
+            //This is to just ensure we have a functional template when it's created
+            using (var picker = new ResourcePicker(conn.ResourceService, ResourceTypes.MapDefinition, ResourcePickerMode.OpenResource))
+            {
+                if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+                {
+                    var flex = ObjectFactory.CreateFlexibleLayout(conn, FusionTemplateNames.Slate);
+                    var grp = flex.MapSet.GetGroupAt(0);
+                    var map = grp.GetMapAt(0);
+
+                    map.SetMapDefinition(picker.ResourceID);
+                    return flex;
+                }
+            }
+            return null;
         }
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourceDataCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourceDataCtrl.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourceDataCtrl.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -30,6 +30,7 @@
 using Maestro.Shared.UI;
 using OSGeo.MapGuide.MaestroAPI.Exceptions;
 using OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.MaestroAPI;
 
 namespace Maestro.Editors.Common
 {
@@ -217,7 +218,10 @@
                                 //var stream = _edSvc.GetResourceData(item.Name);
                                 IResource res = _edSvc.GetEditedResource();
                                 var stream = res.GetResourceData(item.Name);
-                                File.WriteAllBytes(save.FileName, stream.GetBuffer());
+                                using (var fs = File.OpenWrite(save.FileName))
+                                {
+                                    Utility.CopyStream(stream, fs);
+                                }
                             }
                             MessageBox.Show(Properties.Resources.FileDownloaded);
                         }

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.Designer.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -68,6 +68,8 @@
             // 
             // groupBox1
             // 
+            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.groupBox1.Controls.Add(this.lstTemplates);
             this.groupBox1.Location = new System.Drawing.Point(14, 43);
             this.groupBox1.Name = "groupBox1";
@@ -79,7 +81,9 @@
             // lstTemplates
             // 
             this.lstTemplates.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lstTemplates.LargeImageList = this.tplImageList;
             this.lstTemplates.Location = new System.Drawing.Point(3, 16);
+            this.lstTemplates.MultiSelect = false;
             this.lstTemplates.Name = "lstTemplates";
             this.lstTemplates.Size = new System.Drawing.Size(416, 107);
             this.lstTemplates.TabIndex = 0;
@@ -88,6 +92,8 @@
             // 
             // txtTitle
             // 
+            this.txtTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.txtTitle.Location = new System.Drawing.Point(93, 17);
             this.txtTitle.Name = "txtTitle";
             this.txtTitle.Size = new System.Drawing.Size(343, 20);
@@ -96,11 +102,13 @@
             // tplImageList
             // 
             this.tplImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
-            this.tplImageList.ImageSize = new System.Drawing.Size(16, 16);
+            this.tplImageList.ImageSize = new System.Drawing.Size(126, 96);
             this.tplImageList.TransparentColor = System.Drawing.Color.Transparent;
             // 
             // txtTemplateUrl
             // 
+            this.txtTemplateUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.txtTemplateUrl.Location = new System.Drawing.Point(93, 179);
             this.txtTemplateUrl.Name = "txtTemplateUrl";
             this.txtTemplateUrl.ReadOnly = true;

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexLayoutSettingsCtrl.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -34,9 +34,7 @@
 {
     internal delegate void TemplateChangeEventHandler(IApplicationDefinitionTemplateInfo selectedTemplate);
 
-    /// <summary>
-    /// Editor control for Fusion Flexible Layouts (Application Definitions)
-    /// </summary>
+    [ToolboxItem(true)]
     public partial class FlexLayoutSettingsCtrl : EditorBindableCollapsiblePanel
     {
         public FlexLayoutSettingsCtrl()
@@ -95,7 +93,10 @@
                     img = Properties.Resources.question;
                 }
                 tplImageList.Images.Add(tpl.PreviewImageUrl, img);
+            }
 
+            foreach (var tpl in templates.TemplateInfo)
+            {
                 var item = new ListViewItem();
                 item.Tag = tpl;
                 item.Name = tpl.Name;

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.Designer.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -28,18 +28,65 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.settingsCtrl = new Maestro.Editors.Fusion.FlexLayoutSettingsCtrl();
+            this.mapsCtrl = new Maestro.Editors.Fusion.MapSettingsCtrl();
+            this.widgetsCtrl = new Maestro.Editors.Fusion.WidgetSettingsCtrl();
             this.SuspendLayout();
             // 
+            // settingsCtrl
+            // 
+            this.settingsCtrl.ContentBackgroundColor = System.Drawing.SystemColors.Control;
+            this.settingsCtrl.Dock = System.Windows.Forms.DockStyle.Top;
+            this.settingsCtrl.HeaderBackgroundColor = System.Drawing.Color.LightSteelBlue;
+            this.settingsCtrl.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.settingsCtrl.HeaderText = "Flexible Layout Settings";
+            this.settingsCtrl.Location = new System.Drawing.Point(0, 0);
+            this.settingsCtrl.Name = "settingsCtrl";
+            this.settingsCtrl.Size = new System.Drawing.Size(746, 238);
+            this.settingsCtrl.TabIndex = 0;
+            // 
+            // mapsCtrl
+            // 
+            this.mapsCtrl.ContentBackgroundColor = System.Drawing.SystemColors.Control;
+            this.mapsCtrl.Dock = System.Windows.Forms.DockStyle.Top;
+            this.mapsCtrl.HeaderBackgroundColor = System.Drawing.Color.LightSteelBlue;
+            this.mapsCtrl.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.mapsCtrl.HeaderText = "Maps";
+            this.mapsCtrl.Location = new System.Drawing.Point(0, 238);
+            this.mapsCtrl.Name = "mapsCtrl";
+            this.mapsCtrl.Size = new System.Drawing.Size(746, 290);
+            this.mapsCtrl.TabIndex = 1;
+            // 
+            // widgetsCtrl
+            // 
+            this.widgetsCtrl.ContentBackgroundColor = System.Drawing.SystemColors.Control;
+            this.widgetsCtrl.Dock = System.Windows.Forms.DockStyle.Top;
+            this.widgetsCtrl.HeaderBackgroundColor = System.Drawing.Color.LightSteelBlue;
+            this.widgetsCtrl.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.widgetsCtrl.HeaderText = "Widgets";
+            this.widgetsCtrl.Location = new System.Drawing.Point(0, 528);
+            this.widgetsCtrl.Name = "widgetsCtrl";
+            this.widgetsCtrl.Size = new System.Drawing.Size(746, 319);
+            this.widgetsCtrl.TabIndex = 2;
+            // 
             // FlexibleLayoutEditor
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoScroll = true;
+            this.Controls.Add(this.widgetsCtrl);
+            this.Controls.Add(this.mapsCtrl);
+            this.Controls.Add(this.settingsCtrl);
             this.Name = "FlexibleLayoutEditor";
-            this.Size = new System.Drawing.Size(778, 574);
+            this.Size = new System.Drawing.Size(746, 574);
             this.ResumeLayout(false);
 
         }
 
         #endregion
+
+        private FlexLayoutSettingsCtrl settingsCtrl;
+        private MapSettingsCtrl mapsCtrl;
+        private WidgetSettingsCtrl widgetsCtrl;
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/FlexibleLayoutEditor.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -28,6 +28,9 @@
 
 namespace Maestro.Editors.Fusion
 {
+    /// <summary>
+    /// Editor control for Fusion Flexible Layouts (Application Definitions)
+    /// </summary>
     public partial class FlexibleLayoutEditor : EditorBase
     {
         public FlexibleLayoutEditor()
@@ -39,7 +42,11 @@
 
         public override void Bind(IEditorService service)
         {
-            
+            _flexLayout = (IApplicationDefinition)service.GetEditedResource();
+
+            settingsCtrl.Bind(service);
+            mapsCtrl.Bind(service);
+            widgetsCtrl.Bind(service);
         }
     }
 }

Added: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.Designer.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,182 @@
+namespace Maestro.Editors.Fusion
+{
+    partial class MapCtrl
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.label1 = new System.Windows.Forms.Label();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.txtViewX = new System.Windows.Forms.TextBox();
+            this.txtViewY = new System.Windows.Forms.TextBox();
+            this.txtViewScale = new System.Windows.Forms.TextBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.listBox1 = new System.Windows.Forms.ListBox();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(27, 18);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(42, 13);
+            this.label1.TabIndex = 0;
+            this.label1.Text = "Map ID";
+            // 
+            // textBox1
+            // 
+            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.textBox1.Location = new System.Drawing.Point(95, 15);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(359, 20);
+            this.textBox1.TabIndex = 1;
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox1.Controls.Add(this.txtViewScale);
+            this.groupBox1.Controls.Add(this.txtViewY);
+            this.groupBox1.Controls.Add(this.txtViewX);
+            this.groupBox1.Controls.Add(this.label4);
+            this.groupBox1.Controls.Add(this.label3);
+            this.groupBox1.Controls.Add(this.label2);
+            this.groupBox1.Location = new System.Drawing.Point(20, 53);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(449, 106);
+            this.groupBox1.TabIndex = 2;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "Initial View";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(42, 39);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(14, 13);
+            this.label2.TabIndex = 0;
+            this.label2.Text = "X";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(191, 39);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(14, 13);
+            this.label3.TabIndex = 1;
+            this.label3.Text = "Y";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(35, 65);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(34, 13);
+            this.label4.TabIndex = 2;
+            this.label4.Text = "Scale";
+            // 
+            // txtViewX
+            // 
+            this.txtViewX.Location = new System.Drawing.Point(75, 36);
+            this.txtViewX.Name = "txtViewX";
+            this.txtViewX.Size = new System.Drawing.Size(80, 20);
+            this.txtViewX.TabIndex = 3;
+            // 
+            // txtViewY
+            // 
+            this.txtViewY.Location = new System.Drawing.Point(223, 36);
+            this.txtViewY.Name = "txtViewY";
+            this.txtViewY.Size = new System.Drawing.Size(80, 20);
+            this.txtViewY.TabIndex = 4;
+            // 
+            // txtViewScale
+            // 
+            this.txtViewScale.Location = new System.Drawing.Point(75, 62);
+            this.txtViewScale.Name = "txtViewScale";
+            this.txtViewScale.Size = new System.Drawing.Size(80, 20);
+            this.txtViewScale.TabIndex = 5;
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox2.Controls.Add(this.listBox1);
+            this.groupBox2.Location = new System.Drawing.Point(20, 166);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(449, 125);
+            this.groupBox2.TabIndex = 3;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "Maps In Group";
+            // 
+            // listBox1
+            // 
+            this.listBox1.Dock = System.Windows.Forms.DockStyle.Left;
+            this.listBox1.FormattingEnabled = true;
+            this.listBox1.Location = new System.Drawing.Point(3, 16);
+            this.listBox1.Name = "listBox1";
+            this.listBox1.Size = new System.Drawing.Size(300, 95);
+            this.listBox1.TabIndex = 0;
+            // 
+            // MapCtrl
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.label1);
+            this.Name = "MapCtrl";
+            this.Size = new System.Drawing.Size(492, 308);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.TextBox txtViewScale;
+        private System.Windows.Forms.TextBox txtViewY;
+        private System.Windows.Forms.TextBox txtViewX;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.ListBox listBox1;
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, 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.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+
+namespace Maestro.Editors.Fusion
+{
+    public partial class MapCtrl : UserControl
+    {
+        public MapCtrl()
+        {
+            InitializeComponent();
+        }
+
+        private IMapGroup _group;
+
+        public MapCtrl(IMapGroup group) : this() 
+        {
+            _group = group;
+        }
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.resx	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapCtrl.resx	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -28,9 +28,11 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapSettingsCtrl));
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.lstMaps = new System.Windows.Forms.ListView();
+            this.mapImgList = new System.Windows.Forms.ImageList(this.components);
             this.toolStrip1 = new System.Windows.Forms.ToolStrip();
             this.btnAddMap = new System.Windows.Forms.ToolStripButton();
             this.btnRemoveMap = new System.Windows.Forms.ToolStripButton();
@@ -58,10 +60,17 @@
             // 
             resources.ApplyResources(this.lstMaps, "lstMaps");
             this.lstMaps.Name = "lstMaps";
+            this.lstMaps.SmallImageList = this.mapImgList;
             this.lstMaps.UseCompatibleStateImageBehavior = false;
             this.lstMaps.View = System.Windows.Forms.View.List;
             this.lstMaps.SelectedIndexChanged += new System.EventHandler(this.lstMaps_SelectedIndexChanged);
             // 
+            // mapImgList
+            // 
+            this.mapImgList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mapImgList.ImageStream")));
+            this.mapImgList.TransparentColor = System.Drawing.Color.Transparent;
+            this.mapImgList.Images.SetKeyName(0, "map.png");
+            // 
             // toolStrip1
             // 
             this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -112,5 +121,6 @@
         private System.Windows.Forms.ToolStripButton btnAddMap;
         private System.Windows.Forms.ToolStripButton btnRemoveMap;
         private System.Windows.Forms.Panel propertiesPanel;
+        private System.Windows.Forms.ImageList mapImgList;
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -33,6 +33,7 @@
 
 namespace Maestro.Editors.Fusion
 {
+    [ToolboxItem(true)]
     public partial class MapSettingsCtrl : EditorBindableCollapsiblePanel
     {
         public MapSettingsCtrl()
@@ -47,6 +48,7 @@
 
         public override void Bind(IEditorService service)
         {
+            service.RegisterCustomNotifier(this);
             try
             {
                 _fsvc = (IFusionService)service.GetService((int)ServiceType.Fusion);
@@ -62,7 +64,11 @@
             _edsvc = service;
             _edsvc.RegisterCustomNotifier(this);
             _flexLayout = (IApplicationDefinition)service.GetEditedResource();
-            
+
+            foreach (var grp in _flexLayout.MapSet.MapGroups)
+            {
+                AddMap(grp);
+            }
         }
 
         private void AddMap(IMapGroup group)
@@ -96,7 +102,14 @@
 
         private void lstMaps_SelectedIndexChanged(object sender, EventArgs e)
         {
-            
+            var grp = this.SelectedGroup;
+            if (grp != null)
+            {
+                propertiesPanel.Controls.Clear();
+                var mapCtrl = new MapCtrl(grp);
+                mapCtrl.Dock = DockStyle.Fill;
+                propertiesPanel.Controls.Add(mapCtrl);
+            }
         }
 
         private void btnRemoveMap_Click(object sender, EventArgs e)
@@ -107,8 +120,8 @@
                 var group = (IMapGroup)item.Tag;
 
                 _flexLayout.MapSet.RemoveGroup(group);
-
                 lstMaps.Items.Remove(item);
+                OnResourceChanged();
             }
         }
 
@@ -128,7 +141,9 @@
                         name = prefix + counter;
                     }
 
-                    _flexLayout.AddMapGroup(name, true, picker.ResourceID);
+                    var grp = _flexLayout.AddMapGroup(name, true, picker.ResourceID);
+                    OnResourceChanged();
+                    AddMap(grp);
                 }
             }
         }

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx	2010-11-30 08:21:57 UTC (rev 5415)
@@ -121,6 +121,10 @@
   <data name="propertiesPanel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Bottom, Left, Right</value>
   </data>
+  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="propertiesPanel.AutoScroll" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="propertiesPanel.Location" type="System.Drawing.Point, System.Drawing">
     <value>209, 6</value>
@@ -128,7 +132,6 @@
   <data name="propertiesPanel.Size" type="System.Drawing.Size, System.Drawing">
     <value>426, 251</value>
   </data>
-  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="propertiesPanel.TabIndex" type="System.Int32, mscorlib">
     <value>1</value>
   </data>
@@ -156,6 +159,52 @@
   <data name="lstMaps.Size" type="System.Drawing.Size, System.Drawing">
     <value>194, 210</value>
   </data>
+  <metadata name="mapImgList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>108, 16</value>
+  </metadata>
+  <data name="mapImgList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
+    <value>
+        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
+        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk
+        CAAAAk1TRnQBSQFMAwEBAAEQAQABEAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
+        AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
+        AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
+        AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
+        AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ
+        AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm
+        AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz
+        AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm
+        AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm
+        AQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMCzAEA
+        ATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMBAAFm
+        AQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkBAAFm
+        ATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZkBAAJmAcwBAAFmAZkCAAFmAZkBMwEAAWYBmQFm
+        AQABZgKZAQABZgGZAcwBAAFmAZkB/wEAAWYBzAIAAWYBzAEzAQABZgHMAZkBAAFmAswBAAFmAcwB/wEA
+        AWYB/wIAAWYB/wEzAQABZgH/AZkBAAFmAf8BzAEAAcwBAAH/AQAB/wEAAcwBAAKZAgABmQEzAZkBAAGZ
+        AQABmQEAAZkBAAHMAQABmQMAAZkCMwEAAZkBAAFmAQABmQEzAcwBAAGZAQAB/wEAAZkBZgIAAZkBZgEz
+        AQABmQEzAWYBAAGZAWYBmQEAAZkBZgHMAQABmQEzAf8BAAKZATMBAAKZAWYBAAOZAQACmQHMAQACmQH/
+        AQABmQHMAgABmQHMATMBAAFmAcwBZgEAAZkBzAGZAQABmQLMAQABmQHMAf8BAAGZAf8CAAGZAf8BMwEA
+        AZkBzAFmAQABmQH/AZkBAAGZAf8BzAEAAZkC/wEAAcwDAAGZAQABMwEAAcwBAAFmAQABzAEAAZkBAAHM
+        AQABzAEAAZkBMwIAAcwCMwEAAcwBMwFmAQABzAEzAZkBAAHMATMBzAEAAcwBMwH/AQABzAFmAgABzAFm
+        ATMBAAGZAmYBAAHMAWYBmQEAAcwBZgHMAQABmQFmAf8BAAHMAZkCAAHMAZkBMwEAAcwBmQFmAQABzAKZ
+        AQABzAGZAcwBAAHMAZkB/wEAAswCAALMATMBAALMAWYBAALMAZkBAAPMAQACzAH/AQABzAH/AgABzAH/
+        ATMBAAGZAf8BZgEAAcwB/wGZAQABzAH/AcwBAAHMAv8BAAHMAQABMwEAAf8BAAFmAQAB/wEAAZkBAAHM
+        ATMCAAH/AjMBAAH/ATMBZgEAAf8BMwGZAQAB/wEzAcwBAAH/ATMB/wEAAf8BZgIAAf8BZgEzAQABzAJm
+        AQAB/wFmAZkBAAH/AWYBzAEAAcwBZgH/AQAB/wGZAgAB/wGZATMBAAH/AZkBZgEAAf8CmQEAAf8BmQHM
+        AQAB/wGZAf8BAAH/AcwCAAH/AcwBMwEAAf8BzAFmAQAB/wHMAZkBAAH/AswBAAH/AcwB/wEAAv8BMwEA
+        AcwB/wFmAQAC/wGZAQAC/wHMAQACZgH/AQABZgH/AWYBAAFmAv8BAAH/AmYBAAH/AWYB/wEAAv8BZgEA
+        ASEBAAGlAQADXwEAA3cBAAOGAQADlgEAA8sBAAOyAQAD1wEAA90BAAPjAQAD6gEAA/EBAAP4AQAB8AH7
+        Af8BAAGkAqABAAOAAwAB/wIAAf8DAAL/AQAB/wMAAf8BAAH/AQAC/wIAA/8BAA//MQABvA0HAbwxAAEH
+        Af8L9AH/AQcxAAG8AfQGcwJ4ARwCmQH0AbwxAAG8AfQBcwEcAXgBcwJ4AZkBHAGfAcMBCAH0AbwxAAG8
+        AfQBcwEcAXgBcwF4ApkBmAGfARsBBwH0AbwxAAG8AfQDcwN4AZgCmQEIAbsB9AG8MQABvAH/AXMDeAKZ
+        AZ8BmQEbARkBuwH/AbwxAAG8Af8BcwN4ApkBnwGZAfEB3AG6Af8BvDEAAfAB/wFzAXgBmQF4AZkBnwHD
+        AQgBCQHcAboB/wHwMQAB8AH/A3gDmQEIArsCugH/AfAxAAHwAf8BeAOZAcMBGwHxAbsC3AG6Af8B8DEA
+        AfAB/wF4A5kBwwHCAQkBugHcAdsBugH/AfAxAAHwAf8BeAGYApkBCAK7A7oBtAH/AfAxAAHxDf8B8TEA
+        AfMN8gHzMQABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGAFwAD/wIAAQEHAAEBBwABAQcA
+        AQEHAAEBBwABAQcAAQEHAAEBBwABAQcAAQEHAAEBBwABAQcAAQEHAAEBBwABAQcAAQEGAAs=
+</value>
+  </data>
   <data name="lstMaps.TabIndex" type="System.Int32, mscorlib">
     <value>1</value>
   </data>
@@ -267,6 +316,12 @@
   <data name="$this.Size" type="System.Drawing.Size, System.Drawing">
     <value>638, 290</value>
   </data>
+  <data name="&gt;&gt;mapImgList.Name" xml:space="preserve">
+    <value>mapImgList</value>
+  </data>
+  <data name="&gt;&gt;mapImgList.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name="&gt;&gt;btnAddMap.Name" xml:space="preserve">
     <value>btnAddMap</value>
   </data>

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.Designer.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.Designer.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -32,6 +32,7 @@
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WidgetSettingsCtrl));
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.trvWidgets = new System.Windows.Forms.TreeView();
+            this.widgetImageList = new System.Windows.Forms.ImageList(this.components);
             this.toolStrip1 = new System.Windows.Forms.ToolStrip();
             this.btnAddWidget = new System.Windows.Forms.ToolStripDropDownButton();
             this.widgetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -45,7 +46,6 @@
             this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
             this.btnConfigureWidgets = new System.Windows.Forms.ToolStripButton();
             this.propertiesPanel = new System.Windows.Forms.Panel();
-            this.widgetImageList = new System.Windows.Forms.ImageList(this.components);
             this.contentPanel.SuspendLayout();
             this.groupBox1.SuspendLayout();
             this.toolStrip1.SuspendLayout();
@@ -73,11 +73,23 @@
             // trvWidgets
             // 
             this.trvWidgets.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.trvWidgets.ImageIndex = 0;
+            this.trvWidgets.ImageList = this.widgetImageList;
             this.trvWidgets.Location = new System.Drawing.Point(3, 41);
             this.trvWidgets.Name = "trvWidgets";
+            this.trvWidgets.SelectedImageIndex = 0;
             this.trvWidgets.Size = new System.Drawing.Size(194, 239);
             this.trvWidgets.TabIndex = 1;
             // 
+            // widgetImageList
+            // 
+            this.widgetImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("widgetImageList.ImageStream")));
+            this.widgetImageList.TransparentColor = System.Drawing.Color.Transparent;
+            this.widgetImageList.Images.SetKeyName(0, "application.png");
+            this.widgetImageList.Images.SetKeyName(1, "gear.png");
+            this.widgetImageList.Images.SetKeyName(2, "ui-separator.png");
+            this.widgetImageList.Images.SetKeyName(3, "ui-menu.png");
+            // 
             // toolStrip1
             // 
             this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -112,7 +124,7 @@
             // 
             this.widgetToolStripMenuItem.Image = global::Maestro.Editors.Properties.Resources.gear;
             this.widgetToolStripMenuItem.Name = "widgetToolStripMenuItem";
-            this.widgetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.widgetToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
             this.widgetToolStripMenuItem.Text = "Widget";
             this.widgetToolStripMenuItem.Click += new System.EventHandler(this.widgetToolStripMenuItem_Click);
             // 
@@ -120,7 +132,7 @@
             // 
             this.separatorToolStripMenuItem.Image = global::Maestro.Editors.Properties.Resources.ui_separator;
             this.separatorToolStripMenuItem.Name = "separatorToolStripMenuItem";
-            this.separatorToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.separatorToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
             this.separatorToolStripMenuItem.Text = "Separator";
             this.separatorToolStripMenuItem.Click += new System.EventHandler(this.separatorToolStripMenuItem_Click);
             // 
@@ -128,7 +140,7 @@
             // 
             this.flyoutMenuToolStripMenuItem.Image = global::Maestro.Editors.Properties.Resources.ui_menu;
             this.flyoutMenuToolStripMenuItem.Name = "flyoutMenuToolStripMenuItem";
-            this.flyoutMenuToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.flyoutMenuToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
             this.flyoutMenuToolStripMenuItem.Text = "Flyout Menu";
             this.flyoutMenuToolStripMenuItem.Click += new System.EventHandler(this.flyoutMenuToolStripMenuItem_Click);
             // 
@@ -199,20 +211,12 @@
             this.propertiesPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                         | System.Windows.Forms.AnchorStyles.Left)
                         | System.Windows.Forms.AnchorStyles.Right)));
+            this.propertiesPanel.AutoScroll = true;
             this.propertiesPanel.Location = new System.Drawing.Point(209, 6);
             this.propertiesPanel.Name = "propertiesPanel";
             this.propertiesPanel.Size = new System.Drawing.Size(436, 280);
             this.propertiesPanel.TabIndex = 1;
             // 
-            // widgetImageList
-            // 
-            this.widgetImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("widgetImageList.ImageStream")));
-            this.widgetImageList.TransparentColor = System.Drawing.Color.Transparent;
-            this.widgetImageList.Images.SetKeyName(0, "application.png");
-            this.widgetImageList.Images.SetKeyName(1, "gear.png");
-            this.widgetImageList.Images.SetKeyName(2, "ui-separator.png");
-            this.widgetImageList.Images.SetKeyName(3, "ui-menu.png");
-            // 
             // WidgetSettingsCtrl
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -31,6 +31,7 @@
 
 namespace Maestro.Editors.Fusion
 {
+    [ToolboxItem(true)]
     public partial class WidgetSettingsCtrl : EditorBindableCollapsiblePanel
     {
         public WidgetSettingsCtrl()
@@ -63,9 +64,60 @@
             }
             service.RegisterCustomNotifier(this);
             _flexLayout = (IApplicationDefinition)service.GetEditedResource();
-            
+            InitWidgetSet();
         }
 
+        private void InitWidgetSet()
+        {
+            var set = _flexLayout.GetFirstWidgetSet();
+            if (set != null)
+            {
+                foreach (var cnt in set.Containers)
+                {
+                    IUIItemContainer uicnt = cnt as IUIItemContainer;
+                    if (uicnt != null)
+                    {
+                        var node = CreateContainerNode(cnt);
+                        trvWidgets.Nodes.Add(node);
+
+                        foreach (var wgtref in uicnt.Items)
+                        {
+                            var child = CreateNode(wgtref);
+                            node.Nodes.Add(child);
+                            if (wgtref.Function == UiItemFunctionType.Flyout)
+                            {
+                                ProcessFlyoutChildren(child, (IFlyoutItem)wgtref);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        private void ProcessFlyoutChildren(TreeNode parent, IFlyoutItem menu)
+        {
+            foreach (var item in menu.Items)
+            {
+                var node = CreateNode(item);
+                parent.Nodes.Add(node);
+                if (item.Function == UiItemFunctionType.Flyout)
+                {
+                    ProcessFlyoutChildren(node, (IFlyoutItem)item);
+                }
+            }
+        }
+
+        private TreeNode CreateContainerNode(IWidgetContainer cnt)
+        {
+            var node = new TreeNode();
+            node.Name = cnt.Name;
+            node.Text = cnt.Name;
+            node.ImageIndex = IDX_CONTAINER;
+            node.Tag = cnt;
+
+            return node;
+        }
+
         private void widgetToolStripMenuItem_Click(object sender, EventArgs e)
         {
             var cnt = this.SelectedContainer;
@@ -120,18 +172,21 @@
                     {
                         node.ImageIndex = node.SelectedImageIndex = IDX_MENU;
                         node.Text = ((IFlyoutItem)item).Label;
+                        node.Tag = item;
                     }
                     break;
                 case UiItemFunctionType.Separator:
                     {
                         node.ImageIndex = node.SelectedImageIndex = IDX_SEPARATOR;
                         node.Text = Properties.Resources.Separator;
+                        node.Tag = item;
                     }
                     break;
                 case UiItemFunctionType.Widget:
                     {
                         node.ImageIndex = node.SelectedImageIndex = IDX_WIDGET;
                         node.Text = ((IWidgetItem)item).Widget;
+                        node.Tag = item;
                     }
                     break;
             }
@@ -151,6 +206,14 @@
             }
         }
 
+        internal IUIItem SelectedWidgetReference
+        {
+            get
+            {
+                return this.SelectedNode.Tag as IUIItem;
+            }
+        }
+
         private void btnRemoveWidget_Click(object sender, EventArgs e)
         {
 

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.resx	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/WidgetSettingsCtrl.resx	2010-11-30 08:21:57 UTC (rev 5415)
@@ -117,9 +117,6 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
   <metadata name="widgetImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>122, 17</value>
   </metadata>
@@ -128,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACU
-        CQAAAk1TRnQBSQFMAgEBBAEAASgBAAEoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        CQAAAk1TRnQBSQFMAgEBBAEAATgBAAE4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -171,4 +168,7 @@
         AoEGAAGAAQEC/wQAAcABAwL/BAABwAEDAv8EAAHAAQMC/wQAAeABBwL/BAAB/AE/Av8CAAb/AgAL
 </value>
   </data>
+  <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -269,6 +269,12 @@
     <Compile Include="Fusion\FlexLayoutSettingsCtrl.Designer.cs">
       <DependentUpon>FlexLayoutSettingsCtrl.cs</DependentUpon>
     </Compile>
+    <Compile Include="Fusion\MapCtrl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Fusion\MapCtrl.Designer.cs">
+      <DependentUpon>MapCtrl.cs</DependentUpon>
+    </Compile>
     <Compile Include="Fusion\MapSettingsCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -915,6 +921,9 @@
     <EmbeddedResource Include="Fusion\FlexLayoutSettingsCtrl.resx">
       <DependentUpon>FlexLayoutSettingsCtrl.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Fusion\MapCtrl.resx">
+      <DependentUpon>MapCtrl.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Fusion\MapSettingsCtrl.resx">
       <DependentUpon>MapSettingsCtrl.cs</DependentUpon>
     </EmbeddedResource>

Modified: sandbox/maestro-3.0/Maestro.Packaging/PackageBuilder.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Packaging/PackageBuilder.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/Maestro.Packaging/PackageBuilder.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -247,7 +247,9 @@
                         filemap.Add(new KeyValuePair<string, string>(filebase + "_DATA_" + EncodeFilename(rd.Name), System.IO.Path.Combine(temppath, Guid.NewGuid().ToString())));
                         System.IO.FileInfo fi = new System.IO.FileInfo(filemap[filemap.Count - 1].Value);
                         using (System.IO.FileStream fs = new System.IO.FileStream(fi.FullName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
-                            m_connection.ResourceService.GetResourceData(doc.ResourceId, rd.Name).WriteTo(fs);
+                        {
+                            Utility.CopyStream(m_connection.ResourceService.GetResourceData(doc.ResourceId, rd.Name), fs);
+                        }
 
                         AddResourceData(manifest, temppath, doc, fi, filemap[filemap.Count - 1].Key, rd, m_connection);
                     }
@@ -556,7 +558,9 @@
 
                     ms2.Position = 0;
                     using (System.IO.FileStream fs = new System.IO.FileStream(lookup[path], System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
-                        ms2.WriteTo(fs);
+                    {
+                        Utility.CopyStream(ms2, fs);
+                    }
                     ms2.Dispose();
                 }
             }
@@ -784,7 +788,9 @@
 
                                 ms2.Position = 0;
                                 using (System.IO.FileStream fs = new System.IO.FileStream(filemap_lookup[rix.Contentpath], System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
-                                    ms2.WriteTo(fs);
+                                {
+                                    Utility.CopyStream(ms2, fs);
+                                }
                                 ms2.Dispose();
                             }
                         }

Added: sandbox/maestro-3.0/MaestroAPITestRunner/App.config
===================================================================
--- sandbox/maestro-3.0/MaestroAPITestRunner/App.config	                        (rev 0)
+++ sandbox/maestro-3.0/MaestroAPITestRunner/App.config	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <system.net>
+        <defaultProxy>
+            <proxy bypassonlocal="false" usesystemdefault="true" />
+        </defaultProxy>
+    </system.net>
+    <runtime>
+        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+            <dependentAssembly>
+                <assemblyIdentity name="MapGuideDotNetApi" />
+
+                <codeBase version="1.0.0.1" href="MapGuideDotNetApi-2.2.dll"/>
+
+                <bindingRedirect oldVersion="2.0.0.2308" newVersion="1.0.0.1" />
+
+            </dependentAssembly>
+        </assemblyBinding>
+    </runtime>
+</configuration>
\ No newline at end of file

Added: sandbox/maestro-3.0/MaestroAPITestRunner/ConnectionProviders.xml
===================================================================
--- sandbox/maestro-3.0/MaestroAPITestRunner/ConnectionProviders.xml	                        (rev 0)
+++ sandbox/maestro-3.0/MaestroAPITestRunner/ConnectionProviders.xml	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ConnectionProviderRegistry>
+    <ConnectionProvider>
+        <Name>Maestro.Http</Name>
+        <Description>Connection using the mapagent http API</Description>
+        <Assembly>OSGeo.MapGuide.MaestroAPI.Http.dll</Assembly>
+        <Type>OSGeo.MapGuide.MaestroAPI.HttpServerConnection</Type>
+    </ConnectionProvider>
+    <!-- 
+    If you want to use the Maestro.LocalNative provider, you need to set up
+    assembly binding redirection by editing Maestro.exe.config. See these links
+    below for more information:
+    
+    http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/MapGuideDotNetApiVersions
+    
+    http://themapguyde.blogspot.com/2010/10/using-maestro-in-native-mode-with.html
+    -->
+    <ConnectionProvider>
+        <Name>Maestro.LocalNative</Name>
+        <Description>Connection using the MapGuide Web API</Description>
+        <Assembly>OSGeo.MapGuide.MaestroAPI.Native.dll</Assembly>
+        <Type>OSGeo.MapGuide.MaestroAPI.LocalNativeConnection</Type>
+    </ConnectionProvider>
+</ConnectionProviderRegistry>

Modified: sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj
===================================================================
--- sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -32,6 +32,10 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="MapGuideDotNetApi, Version=2.0.0.2308, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\Thirdparty\MapGuideDotNetApi\MapGuideDotNetApi.dll</HintPath>
+    </Reference>
     <Reference Include="nunit-console-runner, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Thirdparty\NUnit\bin\net-2.0\lib\nunit-console-runner.dll</HintPath>
@@ -58,11 +62,23 @@
       <Project>{351D49A3-2E4A-4EC3-AFC2-D56598F44F51}</Project>
       <Name>MaestroAPITests</Name>
     </ProjectReference>
+    <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI.Native\OSGeo.MapGuide.MaestroAPI.Native.csproj">
+      <Project>{F4420153-9DF3-4407-AD65-E8ABED2B6E25}</Project>
+      <Name>OSGeo.MapGuide.MaestroAPI.Native</Name>
+    </ProjectReference>
     <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
       <Project>{80FA3158-8B5F-48D1-A393-0378AFE48A7E}</Project>
       <Name>OSGeo.MapGuide.MaestroAPI</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="ConnectionProviders.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.

Deleted: sandbox/maestro-3.0/MaestroAPITests/App.config
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/App.config	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/MaestroAPITests/App.config	2010-11-30 08:21:57 UTC (rev 5415)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <system.net>
-        <defaultProxy>
-            <proxy bypassonlocal="false" usesystemdefault="true" />
-        </defaultProxy>
-    </system.net>
-</configuration>
\ No newline at end of file

Modified: sandbox/maestro-3.0/MaestroAPITests/MaestroAPITests.csproj
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/MaestroAPITests.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/MaestroAPITests/MaestroAPITests.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -90,7 +90,6 @@
     <None Include="Resources\SelectFeatureSample.xml" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
     <None Include="Resources\SelectSqlSample.xml" />
     <None Include="TestData\DrawingService\CorruptedDwf.dwf">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

Modified: sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -41,6 +41,7 @@
     using OSGeo.MapGuide.MaestroAPI.Resource.Validation;
     using OSGeo.MapGuide.MaestroAPI.Resource;
     using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+    using System.Diagnostics;
 
     [SetUpFixture]
     public class TestBootstrap
@@ -518,9 +519,64 @@
                 }
             }
         }
+
+        public virtual void TestLargeMapCreatePerformance()
+        {
+            //Create a 200 layer, 50 group map. This is not part of the benchmark
+            var mdf = ObjectFactory.CreateMapDefinition(_conn, "LargeMap");
+            string root = "Library://UnitTests/LargeMapTest/";
+
+            //We have to create 200 unique layer definitions (same content) otherwise only one GetResourceContent
+            //call is issued, thus not truly reflecting on how a 200 layer map would really perform
+            //
+            //But that doesn't mean we have to read the same file 200 times
+            MemoryStream ms = new MemoryStream();
+            using (var fs = File.OpenRead("TestData/MappingService/UT_Rail.ldf"))
+            {
+                Utility.CopyStream(fs, ms);
+            }
+
+            int step = 4;
+            int g = 0;
+            for (int i = 0; i < 200; i++)
+            {
+                if (i % step == 0)
+                    g++;
+
+                string layerName = "Layer" + i;
+                string groupName = "Group" + g;
+
+                if (mdf.GetGroupByName(groupName) == null)
+                {
+                    mdf.AddGroup(groupName);
+                }
+
+                //Rewind
+                ms.Position = 0;
+
+                string lid = root + "Layers/Layer" + i + ".LayerDefinition";
+                _conn.ResourceService.SetResourceXmlData(lid, ms);
+                mdf.AddLayer(groupName, layerName, lid);
+            }
+
+            Assert.IsTrue(Array.IndexOf(_conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0);
+            var mapSvc = (IMappingService)_conn.GetService((int)ServiceType.Mapping);
+            var mid = "Session:" + _conn.SessionID + "//TestLargeMapCreatePerformance.Map";
+
+            //Begin Benchmark
+            var sw = new Stopwatch();
+            sw.Start();
+            var map = mapSvc.CreateMap(mid, mdf, 1.0);
+            sw.Stop();
+
+            string msg = "Create Map time for 200 layer, 50 group map: " + sw.ElapsedMilliseconds + "ms";
+            Trace.WriteLine(msg);
+            Console.WriteLine(msg);
+        }
     }
 
-    [TestFixture]
+    [TestFixture(Ignore = true)]
+    //[TestFixture]
     public class HttpRuntimeMapTests : RuntimeMapTests
     {
         protected override IServerConnection CreateTestConnection()
@@ -554,15 +610,22 @@
         {
             base.TestRender12k();
         }
+
+        [Test]
+        public override void TestLargeMapCreatePerformance()
+        {
+            base.TestLargeMapCreatePerformance();
+        }
     }
 
-    [TestFixture(Ignore = true)]
+    //[TestFixture(Ignore = true)]
+    [TestFixture]
     public class LocalRuntimeMapTests : RuntimeMapTests
     {
         protected override IServerConnection CreateTestConnection()
         {
             return ConnectionProviderRegistry.CreateConnection("Maestro.LocalNative",
-                "ConfigPath", "webconfig.ini",
+                "ConfigFile", "webconfig.ini",
                 "Username", "Administrator",
                 "Password", "admin");
         }
@@ -590,5 +653,11 @@
         {
             base.TestRender12k();
         }
+
+        [Test]
+        public override void TestLargeMapCreatePerformance()
+        {
+            base.TestLargeMapCreatePerformance();
+        }
     }
 }

Modified: sandbox/maestro-3.0/MaestroFsPreview/MaestroFsPreview.csproj
===================================================================
--- sandbox/maestro-3.0/MaestroFsPreview/MaestroFsPreview.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/MaestroFsPreview/MaestroFsPreview.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -51,9 +51,9 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Maestro.Shared.UI\bin\Debug\Maestro.Shared.UI.dll</HintPath>
     </Reference>
-    <Reference Include="OSGeo.MapGuide.MaestroAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+    <Reference Include="OSGeo.MapGuide.MaestroAPI, Version=3.0.0.5334, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\OSGeo.MapGuide.MaestroAPI\bin\Debug\OSGeo.MapGuide.MaestroAPI.dll</HintPath>
+      <HintPath>..\SDK\bin\Release\OSGeo.MapGuide.MaestroAPI.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -28,6 +28,5 @@
     /// </summary>
     public enum CommandType : int
     {
-        
     }
 }

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -34,7 +34,7 @@
     /// <summary>
     /// A command to execute Load Procedures
     /// </summary>
-    public interface IExecuteLoadProcedure : ICommand
+    internal interface IExecuteLoadProcedure : ICommand
     {
         /// <summary>
         /// Executes the specified load proc.

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Expression/FdoFunctionNamespace.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Expression/FdoFunctionNamespace.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Expression/FdoFunctionNamespace.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -31,6 +31,8 @@
     /// </summary>
     public static class FdoFunctionNamespace
     {
+        //TODO: Use a data type hierachy akin to FDO's LiteralValue and its descendants
+
         //
         // NOTE: ExpressionEngine will auto-coerce null values to DBNull.Value so when
         // testing for nulls, test for DBNull.Value

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Feature/FeatureSetReader.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Feature/FeatureSetReader.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Feature/FeatureSetReader.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -529,9 +529,6 @@
             get { return m_row[GetName(i)]; }
         }
 
-        /// <summary>
-        /// 
-        /// </summary>
         internal class FeatureSetRowEnumerator : IEnumerator<IDataRecord>
         {
             private FeatureSetReader _parent;

Added: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IO/ReadOnlyRewindableStream.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IO/ReadOnlyRewindableStream.cs	                        (rev 0)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IO/ReadOnlyRewindableStream.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,85 @@
+#region Disclaimer / License
+// Copyright (C) 2010, 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.Generic;
+using System.Text;
+using System.IO;
+
+namespace OSGeo.MapGuide.MaestroAPI.IO
+{
+    /// <summary>
+    /// A read-only, rewindable stream
+    /// </summary>
+    public abstract class ReadOnlyRewindableStream : Stream
+    {
+        /// <summary>
+        /// Resets the internal position of the stream
+        /// </summary>
+        public abstract void Rewind();
+
+        public override bool CanRead
+        {
+            get { return true; }
+        }
+
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        public override bool CanWrite
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Gets whether this stream is rewindable. If not, calls to <see cref="Rewind"/> throw a 
+        /// <see cref="T:System.InvalidOperationException"/>
+        /// </summary>
+        public abstract bool CanRewind { get; }
+
+        public override long Position
+        {
+            get
+            {
+                throw new NotImplementedException();
+            }
+            set
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -147,6 +147,11 @@
         internal RuntimeMap(IMapDefinition mdf, double metersPerUnit)
             : this(mdf.CurrentConnection)
         {
+            //TODO: Performance would be greatly improved if we can take advantage of
+            //the new GetResourceContents() API in 2.2. But can we do this via the combination
+            //of reflection and assembly binding redirection seeing as we are referencing
+            //a 2.0.x assembly?
+
             this.MetersPerUnit = metersPerUnit;
 
             this.MapDefinition = mdf.ResourceID;
@@ -842,7 +847,7 @@
         protected Dictionary<string, ILayerDefinition> layerDefinitionCache = new Dictionary<string, ILayerDefinition>();
 
         /// <summary>
-        /// Creats and adds the layer to the map
+        /// Creates and adds the layer to the map
         /// </summary>
         /// <param name="layerDefinitionId">The layer definition id.</param>
         /// <param name="group">The group.</param>

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -186,6 +186,7 @@
     <Compile Include="Expression\MgFunctionNamespace.cs" />
     <Compile Include="Feature\ClassDefinition.cs" />
     <Compile Include="IConnectionCapabilities.cs" />
+    <Compile Include="IO\ReadOnlyRewindableStream.cs" />
     <Compile Include="MaestroApiProviderAttribute.cs" />
     <Compile Include="ConnectionProviderRegistry.cs" />
     <Compile Include="CoordinateSystem\CoordinateSystem.cs" />
@@ -211,7 +212,6 @@
     <Compile Include="ObjectModels\FeatureSourceInterfaces.cs" />
     <Compile Include="ObjectModels\Geometries.cs" />
     <Compile Include="ObjectModels\GridLayerDefinitionImpl.cs" />
-    <Compile Include="ObjectModels\IDynamicInvokable.cs" />
     <Compile Include="ObjectModels\Envelope.cs" />
     <Compile Include="ObjectModels\FeatureSource.cs" />
     <Compile Include="ObjectModels\IRepositoryItem.cs" />

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -194,6 +194,11 @@
             get { return true; }
         }
 
+        IMapGroup IMapSet.GetGroupAt(int index)
+        {
+            return this.MapSet[index];
+        }
+
         IWidget IApplicationDefinition.CreateWidget(string name, IWidgetInfo widgetInfo)
         {
             var wparams = widgetInfo.Parameters;
@@ -209,9 +214,9 @@
                     ImageClass = widgetInfo.ImageClass,
                     ImageUrl = widgetInfo.ImageUrl,
                     Label = widgetInfo.Label,
-                    Location = widgetInfo.Location ?? string.Empty,
+                    Location = widgetInfo.Location ?? string.Empty, //Required to satisfy content model
                     Name = name,
-                    StatusText = widgetInfo.StatusText ?? string.Empty,
+                    StatusText = widgetInfo.StatusText ?? string.Empty, //Required to satisfy content model
                     Tooltip = widgetInfo.Tooltip,
                     Type = widgetInfo.Type
                 };
@@ -221,7 +226,7 @@
                 widget = new WidgetType()
                 {
                     Extension = new CustomContentType() { Any = new XmlElement[0] },
-                    Location = widgetInfo.Location ?? string.Empty,
+                    Location = widgetInfo.Location ?? string.Empty, //Required to satisfy content model
                     Name = name,
                     Type = widgetInfo.Type,
                 };
@@ -255,11 +260,12 @@
 
         IUIItemContainer IApplicationDefinition.CreateContainer(string name, IApplicationDefinitionContainerInfo containerInfo)
         {
-            return new UiItemContainerType() 
-            { 
-                Name = name, 
-                Type = containerInfo.Type, 
-                Item = new System.ComponentModel.BindingList<UiItemType>() 
+            return new UiItemContainerType()
+            {
+                Name = name,
+                Type = containerInfo.Type,
+                Item = new System.ComponentModel.BindingList<UiItemType>(),
+                Extension = new CustomContentType() { Any = new XmlElement[0] }
             };
         }
 
@@ -650,6 +656,19 @@
 
     partial class MapGroupType : IMapGroup
     {
+        int IMapGroup.MapCount
+        {
+            get
+            {
+                return this.Map.Count;
+            }
+        }
+
+        IMap IMapGroup.GetMapAt(int index)
+        {
+            return (IMap)this.Map[index];
+        }
+
         IMapView IMapGroup.InitialView
         {
             get

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -634,6 +634,26 @@
             Check.NotNull(map, "map");
             map.SetValue("ResourceId", mapDefId);
         }
+
+        /// <summary>
+        /// Gets the first widget set of this application definition.
+        /// </summary>
+        /// <param name="appDef"></param>
+        /// <returns></returns>
+        public static IWidgetSet GetFirstWidgetSet(this IApplicationDefinition appDef)
+        {
+            Check.NotNull(appDef, "appDef");
+            IWidgetSet set = null;
+            foreach (var wgt in appDef.WidgetSets)
+            {
+                if (set == null)
+                {
+                    set = wgt;
+                    break;
+                }
+            }
+            return set;
+        }
     }
 
         /*
@@ -788,6 +808,8 @@
 
         int MapGroupCount { get; }
 
+        IMapGroup GetGroupAt(int index);
+
         void AddGroup(IMapGroup group);
 
         void RemoveGroup(IMapGroup group);
@@ -804,6 +826,10 @@
         void AddMap(IMap map);
 
         void RemoveMap(IMap map);
+
+        int MapCount { get; }
+
+        IMap GetMapAt(int index);
     }
 
     public interface IMap : INotifyPropertyChanged, IExtensibleElement

Deleted: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/IDynamicInvokable.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/IDynamicInvokable.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/IDynamicInvokable.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -1,136 +0,0 @@
-#region Disclaimer / License
-// Copyright (C) 2010, 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.Generic;
-using System.Text;
-using System.Reflection;
-using System.ComponentModel;
-
-namespace OSGeo.MapGuide.ObjectModels
-{
-    /// <summary>
-    /// Interface allowing for dynamic invocation of public properties and methods.
-    /// </summary>
-    public interface IDynamicInvokable
-    {
-        //Nothing here. All done through extension methods baby!
-    }
-
-    /// <summary>
-    /// Extension method class
-    /// </summary>
-    public static class DynamicInvokableExtensions
-    {
-        /// <summary>
-        /// Gets the value of the specified property
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <returns></returns>
-        /// <exception cref="MissingMemberException">Thrown if the specified property could not be found</exception>
-        public static object InvokeGetProperty(this IDynamicInvokable idi, string name)
-        {
-            var prop = idi.GetType().GetProperty(name);
-            if (prop != null)
-                return prop.GetValue(idi, null);
-
-            throw new MissingMemberException(name);
-        }
-
-        /// <summary>
-        /// Attempts to get the value of the specified property. Returns the specified default value if the named
-        /// property could not be found
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <param name="defaultValue"></param>
-        /// <returns></returns>
-        public static object TryInvokeGetProperty(this IDynamicInvokable idi, string name, object defaultValue)
-        {
-            var prop = idi.GetType().GetProperty(name);
-            if (prop != null)
-                return prop.GetValue(idi, null);
-
-            return defaultValue;
-        }
-
-        /// <summary>
-        /// Sets the value of the specified property
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <param name="value"></param>
-        /// <exception cref="MissingMemberException">thrown if the specified property could not be found</exception>
-        public static void InvokeSetProperty(this IDynamicInvokable idi, string name, object value)
-        {
-            var prop = idi.GetType().GetProperty(name);
-            if (prop != null)
-                prop.SetValue(idi, value, null);
-            
-            throw new MissingMemberException(name);
-        }
-
-        /// <summary>
-        /// Attempts to set the value of the specified property. Does nothing if the named property
-        /// could not be found
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <param name="value"></param>
-        public static void TryInvokeSetProperty(this IDynamicInvokable idi, string name, object value)
-        {
-            var prop = idi.GetType().GetProperty(name);
-            if (prop != null)
-                prop.SetValue(idi, value, null);
-        }
-
-        /// <summary>
-        /// Invokes a method of the specified name with the specified arguments. If the method returns
-        /// a value, it is discarded. If you require the return value, use <see cref="InvokeMethodWithReturnValue"/>
-        /// instead
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <param name="args"></param>
-        public static void InvokeMethod(this IDynamicInvokable idi, string name, params object[] args)
-        {
-            var method = idi.GetType().GetMethod(name);
-            if (method != null)
-                method.Invoke(idi, args);
-
-            throw new MissingMethodException(name);
-        }
-
-        /// <summary>
-        /// Invokes a method of the specified name with the specified arguments.
-        /// </summary>
-        /// <param name="idi"></param>
-        /// <param name="name"></param>
-        /// <param name="args"></param>
-        public static object InvokeMethodWithReturnValue(this IDynamicInvokable idi, string name, params object[] args)
-        {
-            var method = idi.GetType().GetMethod(name);
-            if (method != null)
-                return method.Invoke(idi, args);
-
-            throw new MissingMethodException(name);
-        }
-    }
-}

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -602,7 +602,7 @@
     /// <summary>
     /// Style specification for a area geometry layer
     /// </summary>
-    public interface IAreaVectorStyle : IVectorStyle, IDynamicInvokable
+    public interface IAreaVectorStyle : IVectorStyle
     {
         /// <summary>
         /// Enumerates the rules in this specification
@@ -630,7 +630,7 @@
     /// <summary>
     /// Style specification for a line geometry layer
     /// </summary>
-    public interface ILineVectorStyle : IVectorStyle, IDynamicInvokable
+    public interface ILineVectorStyle : IVectorStyle
     {
         /// <summary>
         /// Enumerates the rules in this specification
@@ -658,7 +658,7 @@
     /// <summary>
     /// Style specification for a point geometry layer
     /// </summary>
-    public interface IPointVectorStyle : IVectorStyle, IDynamicInvokable
+    public interface IPointVectorStyle : IVectorStyle
     {
         /// <summary>
         /// Gets or sets whether to create a text layer
@@ -696,7 +696,7 @@
     /// <summary>
     /// Base interface for style rules of all geometric types
     /// </summary>
-    public interface IVectorRule : IDynamicInvokable
+    public interface IVectorRule 
     {
         /// <summary>
         /// Gets or sets the label for the rule to be displayed in the legend

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -247,7 +247,7 @@
                 Name = name,
                 BackgroundColor = Color.White,
                 MapLayer = new System.ComponentModel.BindingList<OSGeo.MapGuide.ObjectModels.MapDefinition_1_0_0.MapLayerType>(),
-                //MapLayerGroup = new System.ComponentModel.BindingList<MapLayerGroupType>(),
+                MapLayerGroup = new System.ComponentModel.BindingList<OSGeo.MapGuide.ObjectModels.MapDefinition_1_0_0.MapLayerGroupType>(),
             };
         }
 
@@ -308,9 +308,10 @@
 
         static readonly string[] parameterizedWidgets = 
         {
+            KnownWidgetNames.CTRLClick,
             KnownWidgetNames.ZoomOnClick,
             KnownWidgetNames.ExtentHistory,
-            KnownWidgetNames.BufferPanel,
+            KnownWidgetNames.Buffer,
             KnownWidgetNames.Measure,
             KnownWidgetNames.InvokeScript,
             KnownWidgetNames.InvokeURL,
@@ -330,7 +331,23 @@
         {
             Check.NotNull(owner, "owner");
             Check.Precondition(Array.IndexOf(owner.Capabilities.SupportedServices, (int)ServiceType.Fusion) >= 0, "Required Fusion service not supported on this connection");
+
+            var fusionSvc = (IFusionService)owner.GetService((int)ServiceType.Fusion);
+            var templates = fusionSvc.GetApplicationTemplates();
             
+            var appDef = DeserializeEmbeddedFlexLayout();
+            //Find matching template.
+            var tpl = templates.FindTemplate(templateName);
+            if (tpl != null)
+            {
+                appDef.TemplateUrl = tpl.LocationUrl;
+                appDef.Title = tpl.Name;
+            }
+            appDef.CurrentConnection = owner;
+            return appDef;
+            /*
+            Check.Precondition(Array.IndexOf(owner.Capabilities.SupportedServices, (int)ServiceType.Fusion) >= 0, "Required Fusion service not supported on this connection");
+            
             IApplicationDefinition appDef = new ApplicationDefinitionType()
             {
                 CurrentConnection = owner,
@@ -343,7 +360,9 @@
             var widgets = fusionSvc.GetApplicationWidgets();
             var containers = fusionSvc.GetApplicationContainers();
 
-            //Find matching template
+            //Find matching template. If it's a known template we should be able to
+            //build it programatically, otherwise return a deserialized copy from our
+            //embedded resource
             var tpl = templates.FindTemplate(templateName);
             if (tpl != null)
             {
@@ -361,7 +380,7 @@
 
             //Context menus, every template has them
             var mapContextMenu = appDef.CreateContainer("MapContextMenu", containers.FindContainer("ContextMenu"));
-            var taskPaneMenu = appDef.CreateContainer("TaskContextMenu", containers.FindContainer("ContextMenu"));
+            var taskPaneMenu = appDef.CreateContainer("TaskMenu", containers.FindContainer("ContextMenu"));
 
             //Menu
             var menu = appDef.CreateContainer("FileMenu", containers.FindContainer("Toolbar"));
@@ -420,7 +439,7 @@
             buffer.Tooltip = Res.ADF_Widget_Buffer_Label;
 
             //Measure
-            var measure = (IUIWidget)appDef.CreateWidget("tbBuffer", widgets.FindWidget(KnownWidgetNames.Measure));
+            var measure = (IUIWidget)appDef.CreateWidget("Measure", widgets.FindWidget(KnownWidgetNames.Measure));
             var measureParams = new NameValueCollection();
             measureParams["Type"] = "both";
             measureParams["MeasureTooltipContainer"] = "MeasureResult";
@@ -469,6 +488,7 @@
             widgetSet.AddWidget(prevView);
             widgetSet.AddWidget(nextView);
             widgetSet.AddWidget(buffer);
+            widgetSet.AddWidget(measure);
             widgetSet.AddWidget(showOverview);
             widgetSet.AddWidget(showTaskPane);
             widgetSet.AddWidget(showLegend);
@@ -495,8 +515,8 @@
             toolbar.AddItem(appDef.CreateWidgetReference(KnownWidgetNames.SelectPolygon));
             toolbar.AddItem(appDef.CreateWidgetReference(KnownWidgetNames.ClearSelection));
             
-            toolbar.AddItem(appDef.CreateWidgetReference(KnownWidgetNames.Buffer));
-            toolbar.AddItem(appDef.CreateWidgetReference(KnownWidgetNames.Measure));
+            toolbar.AddItem(appDef.CreateWidgetReference(buffer.Name));
+            toolbar.AddItem(appDef.CreateWidgetReference(measure.Name));
             
             //2.2 specific stuff
             if (owner.SiteVersion >= new Version(2, 2))
@@ -619,6 +639,7 @@
             }
 
             return appDef;
+             */
         }
 
         internal static IApplicationDefinition DeserializeEmbeddedFlexLayout()

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -1104,7 +1104,7 @@
         /// <param name="resourceID">The id of the resource to fetch data from</param>
         /// <param name="dataname">The name of the associated data item</param>
         /// <returns>A stream containing the references resource data</returns>
-        abstract public System.IO.MemoryStream GetResourceData(string resourceID, string dataname);
+        abstract public System.IO.Stream GetResourceData(string resourceID, string dataname);
 
         /// <summary>
         /// Uploads data to a resource

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -31,7 +31,7 @@
     /// <summary>
     /// Represents an editable MapGuide Resource
     /// </summary>
-    public interface IResource : IVersionedEntity, ICloneable, INotifyPropertyChanged, IDynamicInvokable
+    public interface IResource : IVersionedEntity, ICloneable, INotifyPropertyChanged
     {
         /// <summary>
         /// Gets or sets the current connection.
@@ -152,7 +152,7 @@
         /// <param name="res"></param>
         /// <param name="dataName"></param>
         /// <returns></returns>
-        public static MemoryStream GetResourceData(this IResource res, string dataName)
+        public static Stream GetResourceData(this IResource res, string dataName)
         {
             if (res.CurrentConnection == null)
                 throw new ArgumentException(Properties.Resources.ERR_RESOURCE_NOT_ATTACHED);

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -46,6 +46,15 @@
             if (resource.ResourceType != OSGeo.MapGuide.MaestroAPI.ResourceTypes.ApplicationDefinition)
                 return null;
 
+            //TODO: Other items to check for
+            //
+            // - References to non-existent widgets
+            // - MapWidget checks
+            //   - Ensure map id checks out
+            //   - Ensure context menu id checks out
+            // - Verify containers of template are all referenced within this flexible layout
+            // - Check required parameters of widgets are satisfied
+
             List<ValidationIssue> issues = new List<ValidationIssue>();
 
             IApplicationDefinition fusionApp = resource as IApplicationDefinition;

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -108,7 +108,7 @@
         /// <param name="resourceID"></param>
         /// <param name="dataname"></param>
         /// <returns></returns>
-        System.IO.MemoryStream GetResourceData(string resourceID, string dataname);
+        System.IO.Stream GetResourceData(string resourceID, string dataname);
 
         /// <summary>
         /// Gets the document header of the specified resource

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Utility.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Utility.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -21,6 +21,7 @@
 using System.Drawing;
 using Topology.Geometries;
 using System.Collections.Generic;
+using OSGeo.MapGuide.MaestroAPI.IO;
 
 namespace OSGeo.MapGuide.MaestroAPI
 {
@@ -151,10 +152,32 @@
 			int r;
 			byte[] buf = new byte[1024];
 
-            if (rewind && source.CanSeek)
-                try { source.Position = 0; }
-                catch { }
+            bool rewound = false;
+            if (rewind)
+            {
+                if (source.CanSeek)
+                {
+                    try 
+                    { 
+                        source.Position = 0;
+                        rewound = true;
+                    }
+                    catch { }
+                }
+                else
+                {
+                    ReadOnlyRewindableStream roSource = source as ReadOnlyRewindableStream;
+                    if (roSource != null && roSource.CanRewind)
+                    {
+                        roSource.Rewind();
+                        rewound = true;
+                    }
+                }
 
+                //if (!rewound)
+                //    throw new InvalidOperationException("Could not rewind the source stream. Most likely the source stream does not support seeking or rewinding"); //LOCALIZEME
+            }
+
 			do
 			{
 				r  = source.Read(buf, 0, buf.Length);

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -369,10 +369,11 @@
             return string.Empty;
 		}
 
-		public override System.IO.MemoryStream GetResourceData(string resourceID, string dataname)
+        public override System.IO.Stream GetResourceData(string resourceID, string dataname)
 		{
 			string req = m_reqBuilder.GetResourceData(resourceID, dataname);
-			
+            return this.OpenRead(req);
+            /*
 			System.IO.MemoryStream ms = new System.IO.MemoryStream();
 			Utility.CopyStream(this.OpenRead(req), ms);
 
@@ -382,6 +383,7 @@
 #endif
 			ms.Position = 0;
 			return ms;
+             */
 		}
 
 		public override Stream GetResourceXmlData(string resourceID)

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -183,7 +183,7 @@
 			return (FdoProviderCapabilities) base.DeserializeObject(typeof(FdoProviderCapabilities), Utility.MgStreamToNetStream(fes, fes.GetType().GetMethod("GetCapabilities"), new object[] { provider }));
 		}
 
-		public override System.IO.MemoryStream GetResourceData(string resourceID, string dataname)
+		public override System.IO.Stream GetResourceData(string resourceID, string dataname)
 		{
 			MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
 			return Utility.MgStreamToNetStream(res, res.GetType().GetMethod("GetResourceData"), new object[] { new MgResourceIdentifier(resourceID), dataname });
@@ -381,7 +381,7 @@
 		public ResourceDataList EnumerateResourceData(string resourceID)
 		{
 			MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-			System.IO.MemoryStream ms = Utility.MgStreamToNetStream(res, res.GetType().GetMethod("EnumerateResourceData"), new object[] { new MgResourceIdentifier(resourceID) });			
+			System.IO.Stream ms = Utility.MgStreamToNetStream(res, res.GetType().GetMethod("EnumerateResourceData"), new object[] { new MgResourceIdentifier(resourceID) });			
 			return (ResourceDataList)DeserializeObject(typeof(ResourceDataList), ms);
 		}
 
@@ -459,7 +459,7 @@
 		public override ResourceReferenceList EnumerateResourceReferences(string resourceid)
 		{
 			MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-			System.IO.MemoryStream ms = Utility.MgStreamToNetStream(res, res.GetType().GetMethod("EnumerateReferences"), new object[] { new MgResourceIdentifier(resourceid) });
+            System.IO.Stream ms = Utility.MgStreamToNetStream(res, res.GetType().GetMethod("EnumerateReferences"), new object[] { new MgResourceIdentifier(resourceid) });
 			return (ResourceReferenceList)DeserializeObject(typeof(ResourceReferenceList), ms);
 		}
 

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureSetReader.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureSetReader.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureSetReader.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -141,7 +141,6 @@
                             try
                             {
                                 //No MapGuide dll, convert to WKT and then to internal representation
-                                System.IO.MemoryStream ms = Utility.MgStreamToNetStream(rd, rd.GetType().GetMethod("GetGeometry"), new string[] { p });
                                 OSGeo.MapGuide.MgAgfReaderWriter rdw = new OSGeo.MapGuide.MgAgfReaderWriter();
                                 OSGeo.MapGuide.MgGeometry g = rdw.Read(rd.GetGeometry(p));
                                 OSGeo.MapGuide.MgWktReaderWriter rdww = new OSGeo.MapGuide.MgWktReaderWriter();

Added: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs	                        (rev 0)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -0,0 +1,106 @@
+#region Disclaimer / License
+// Copyright (C) 2010, 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.Generic;
+using System.Text;
+using System.IO;
+using OSGeo.MapGuide.MaestroAPI.IO;
+
+namespace OSGeo.MapGuide.MaestroAPI.Native
+{
+    /// <summary>
+    /// Represents a method that returns a <see cref="OSGeo.MapGuide.MgByteReader"/> instance
+    /// </summary>
+    /// <returns></returns>
+    public delegate MgByteReader GetByteReaderMethod();
+
+    /// <summary>
+    /// A read-only <see cref="System.IO.Stream"/> adapter for the <see cref="OSGeo.MapGuide.MgByteReader"/>
+    /// class.
+    /// </summary>
+    public class MgReadOnlyStream : ReadOnlyRewindableStream
+    {
+        private MgByteReader _reader;
+
+        /// <summary>
+        /// Creates a new instance
+        /// </summary>
+        /// <param name="method"></param>
+        public MgReadOnlyStream(GetByteReaderMethod method)
+        {
+            _reader = method();
+        }
+
+        ~MgReadOnlyStream()
+        {
+            Dispose(false);
+            GC.SuppressFinalize(this);
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                _reader.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        public override void Flush()
+        {
+            
+        }
+
+        public override long Length
+        {
+            get { return _reader.GetLength(); }
+        }
+
+        public override bool CanRewind
+        {
+            get { return _reader.IsRewindable(); }
+        }
+
+        public override void Rewind()
+        {
+            if (!CanRewind)
+                throw new InvalidOperationException("This stream is not rewindable"); //LOCALIZEME
+
+            _reader.Rewind();
+        }
+
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            int read = 0;
+            //For good times, please always have the offset as 0
+            if (offset == 0)
+            {
+                read = _reader.Read(buffer, count);
+            }
+            else //So you want to play the hard way eh? Bad performance for you!
+            {
+                byte[] b = new byte[count];
+                read = _reader.Read(b, count);
+                Array.Copy(b, 0, buffer, offset, read); 
+            }
+            return read;
+        }
+    }
+}

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/OSGeo.MapGuide.MaestroAPI.Native.csproj
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/OSGeo.MapGuide.MaestroAPI.Native.csproj	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/OSGeo.MapGuide.MaestroAPI.Native.csproj	2010-11-30 08:21:57 UTC (rev 5415)
@@ -52,6 +52,7 @@
     <Compile Include="..\Properties\GlobalAssemblyInfo.cs">
       <Link>GlobalAssemblyInfo.cs</Link>
     </Compile>
+    <Compile Include="MgReadOnlyStream.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="LocalNativeCapabilities.cs" />
     <Compile Include="LocalNativeConnection.cs" />

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs	2010-11-29 20:45:16 UTC (rev 5414)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs	2010-11-30 08:21:57 UTC (rev 5415)
@@ -64,11 +64,30 @@
         /// <param name="source">The object which has a stream</param>
         /// <param name="mi">The method to call</param>
         /// <param name="args">Arguments to the method</param>
-        /// <returns>A memorystream with the MgStream's content</returns>
-        public static System.IO.MemoryStream MgStreamToNetStream(object source, System.Reflection.MethodInfo mi, object[] args)
+        /// <returns>A read-only <see cref="System.IO.Stream"/> that wraps the underlying <see cref="OSGeo.MapGuide.MgByteReader"/></returns>
+        public static System.IO.Stream MgStreamToNetStream(object source, System.Reflection.MethodInfo mi, object[] args)
         {
+            /*
             try
             {
+                //How can we work around invalidating MgByteReader when it's passed as a parameter?
+                //Cheat the system by deferring execution of MgByteReader reference assignment until
+                //we're in the ctor of MgReadOnlyStream. Only MgReadOnlyStream has access to the MgByteReader
+                //Everything else interacts through the .net Stream interface. Win-win.
+                GetByteReaderMethod method = () => { return (OSGeo.MapGuide.MgByteReader)mi.Invoke(source, args); };
+                return new MgReadOnlyStream(method);
+            }
+            catch (System.Reflection.TargetInvocationException tex)
+            {
+                if (tex.InnerException != null)
+                    throw tex.InnerException;
+                else
+                    throw;
+            }
+             */
+            
+            try
+            {
                 OSGeo.MapGuide.MgByteReader rd = (OSGeo.MapGuide.MgByteReader)mi.Invoke(source, args);
                 System.IO.MemoryStream ms = new System.IO.MemoryStream();
                 byte[] buf = new byte[1024];



More information about the mapguide-commits mailing list