[mapguide-commits] r8769 - in trunk/Tools/Maestro: Maestro.Editors/MapDefinition MaestroFsPreview

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 2 22:45:30 PDT 2015


Author: jng
Date: 2015-10-02 22:45:30 -0700 (Fri, 02 Oct 2015)
New Revision: 8769

Modified:
   trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
   trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj
Log:
- Code cleanup in Map Definition editor
- Fix references in MaestroFsPreview (bin references being used instead of project ones)

Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2015-10-01 12:47:36 UTC (rev 8768)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2015-10-03 05:45:30 UTC (rev 8769)
@@ -205,14 +205,12 @@
                 txtTileSet.Text = mdf3.TileSetDefinitionID;
         }
 
-        private void InitInlineModel()
-        {
-            trvBaseLayers.Model = _tiledLayerModel = new TiledLayerModel(_map.BaseMap);
-        }
+        private void InitInlineModel() => trvBaseLayers.Model = _tiledLayerModel = new TiledLayerModel(_map.BaseMap);
 
         private void OnMapPropertyChanged(object sender, PropertyChangedEventArgs e)
         {
-            if (e.PropertyName == "TileSourceType") //NOXLATE
+            IMapDefinition3 mdf3 = null;
+            if (e.PropertyName == nameof(mdf3.TileSourceType))
             {
                 var mdf = _map as IMapDefinition3;
                 if (mdf != null)
@@ -244,12 +242,9 @@
 
         private void RefreshModels()
         {
-            if (_doLayerModel != null)
-                _doLayerModel.Invalidate();
-            if (_grpLayerModel != null)
-                _grpLayerModel.Invalidate();
-            if (_tiledLayerModel != null)
-                _tiledLayerModel.Invalidate();
+            _doLayerModel?.Invalidate();
+            _grpLayerModel?.Invalidate();
+            _tiledLayerModel?.Invalidate();
         }
 
         public event OpenLayerEventHandler RequestLayerOpen;
@@ -262,9 +257,7 @@
                 var layer = node.Tag as LayerItem;
                 if (layer != null)
                 {
-                    var handler = this.RequestLayerOpen;
-                    if (handler != null)
-                        handler(this, layer.Tag.ResourceId);
+                    this.RequestLayerOpen?.Invoke(this, layer.Tag.ResourceId);
                 }
             }
         }
@@ -277,9 +270,7 @@
                 var layer = node.Tag as LayerItem;
                 if (layer != null)
                 {
-                    var handler = this.RequestLayerOpen;
-                    if (handler != null)
-                        handler(this, layer.Tag.ResourceId);
+                    this.RequestLayerOpen?.Invoke(this, layer.Tag.ResourceId);
                 }
             }
         }
@@ -802,7 +793,7 @@
                     var blg = _map.BaseMap.GetGroup(groupName);
                     while (blg != null)
                     {
-                        groupName = layGroup.Name + " (" + counter + ")";
+                        groupName = $"{layGroup.Name} ({counter})";
                         counter++;
 
                         blg = _map.BaseMap.GetGroup(groupName);
@@ -844,7 +835,7 @@
                     while (_map.GetGroupByName(groupName) != null)
                     {
                         counter++;
-                        groupName = group.Tag.Name + "(" + counter + ")";
+                        groupName = $"{group.Tag.Name} ({counter})";
                     }
                     _map.AddGroup(groupName);
                     int layerCount = _map.GetDynamicLayerCount();
@@ -1046,7 +1037,7 @@
         {
             //The node tag will probably be different, but the wrapped
             //instance is what we're checking for
-            var it = RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => { return tag.Tag == item.Tag; });
+            var it = RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => tag.Tag == item.Tag);
             if (it != null)
                 OnBaseLayerItemSelected(it);
         }
@@ -1055,7 +1046,7 @@
         {
             //The node tag will probably be different, but the wrapped
             //instance is what we're checking for
-            var it = RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => { return tag.Tag == layer; });
+            var it = RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => tag.Tag == layer);
             if (it != null)
                 OnBaseLayerItemSelected(it);
         }
@@ -1064,7 +1055,7 @@
         {
             //The node tag will probably be different, but the wrapped
             //instance is what we're checking for
-            var lyr = RestoreSelection<LayerItem>(trvLayerDrawingOrder, (tag) => { return tag.Tag == layer.Tag; });
+            var lyr = RestoreSelection<LayerItem>(trvLayerDrawingOrder, (tag) => tag.Tag == layer.Tag);
             if (lyr != null)
                 OnDrawOrderLayerItemSelected(lyr);
         }
@@ -1073,7 +1064,7 @@
         {
             //The node tag will probably be different, but the wrapped
             //instance is what we're checking for
-            var lyr = RestoreSelection<LayerItem>(trvLayerDrawingOrder, (tag) => { return tag.Tag == layer; });
+            var lyr = RestoreSelection<LayerItem>(trvLayerDrawingOrder, (tag) => tag.Tag == layer);
             if (lyr != null)
                 OnDrawOrderLayerItemSelected(lyr);
         }
@@ -1118,23 +1109,9 @@
             return layer;
         }
 
-        private object GetSelectedDrawOrderItem()
-        {
-            if (trvLayerDrawingOrder.SelectedNode != null)
-            {
-                return trvLayerDrawingOrder.SelectedNode.Tag;
-            }
-            return null;
-        }
+        private object GetSelectedDrawOrderItem() => trvLayerDrawingOrder.SelectedNode?.Tag;
 
-        private object GetSelectedLayerGroupItem()
-        {
-            if (trvLayersGroup.SelectedNode != null)
-            {
-                return trvLayersGroup.SelectedNode.Tag;
-            }
-            return null;
-        }
+        private object GetSelectedLayerGroupItem() => trvLayersGroup.SelectedNode?.Tag;
 
         private IEnumerable<object> GetSelectedLayerGroupItems()
         {
@@ -1147,13 +1124,7 @@
             return result;
         }
 
-        private object GetSelectedTiledLayerItem()
-        {
-            if (trvBaseLayers.SelectedNode != null)
-                return trvBaseLayers.SelectedNode.Tag;
-            else
-                return null;
-        }
+        private object GetSelectedTiledLayerItem() => trvBaseLayers.SelectedNode?.Tag;
 
         private IEnumerable<object> GetSelectedTiledLayerItems()
         {
@@ -1499,22 +1470,15 @@
                 var layer = node.Tag as BaseLayerItem;
                 if (layer != null)
                 {
-                    var handler = this.RequestLayerOpen;
-                    if (handler != null)
-                        handler(this, layer.Tag.ResourceId);
+                    this.RequestLayerOpen?.Invoke(this, layer.Tag.ResourceId);
                 }
             }
         }
 
         private void trvLayersGroup_ItemDrag(object sender, ItemDragEventArgs e)
-        {
-            trvLayersGroup.DoDragDrop(e.Item, DragDropEffects.All);
-        }
+            => trvLayersGroup.DoDragDrop(e.Item, DragDropEffects.All);
 
-        private void trvLayersGroup_DragEnter(object sender, DragEventArgs e)
-        {
-            HandleDragEnter(e);
-        }
+        private void trvLayersGroup_DragEnter(object sender, DragEventArgs e) => HandleDragEnter(e);
 
         private static void HandleDragEnter(DragEventArgs e)
         {
@@ -1827,15 +1791,11 @@
             }
         }
 
-        private void trvLayerDrawingOrder_ItemDrag(object sender, ItemDragEventArgs e)
-        {
-            trvLayerDrawingOrder.DoDragDrop(e.Item, DragDropEffects.All);
-        }
+        private void trvLayerDrawingOrder_ItemDrag(object sender, ItemDragEventArgs e) 
+            => trvLayerDrawingOrder.DoDragDrop(e.Item, DragDropEffects.All);
 
         private void trvBaseLayers_ItemDrag(object sender, ItemDragEventArgs e)
-        {
-            trvBaseLayers.DoDragDrop(e.Item, DragDropEffects.All);
-        }
+            => trvBaseLayers.DoDragDrop(e.Item, DragDropEffects.All);
 
         private void trvBaseLayers_DragDrop(object sender, DragEventArgs e)
         {
@@ -1947,10 +1907,7 @@
             }
         }
 
-        private void trvBaseLayers_DragEnter(object sender, DragEventArgs e)
-        {
-            HandleDragEnter(e);
-        }
+        private void trvBaseLayers_DragEnter(object sender, DragEventArgs e) => HandleDragEnter(e);
 
         private void trvBaseLayers_DragOver(object sender, DragEventArgs e)
         {

Modified: trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj	2015-10-01 12:47:36 UTC (rev 8768)
+++ trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj	2015-10-03 05:45:30 UTC (rev 8769)
@@ -59,24 +59,8 @@
   <ItemGroup>
     <Reference Include="Aga.Controls, Version=1.7.0.0, Culture=neutral, PublicKeyToken=fcc90fbf924463a3, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Thirdparty\TreeViewAdv\Aga.Controls\obj\Debug\Aga.Controls.dll</HintPath>
+      <HintPath>..\Maestro\packages\TreeViewAdv.1.7.0.0\lib\net\Aga.Controls.dll</HintPath>
     </Reference>
-    <Reference Include="Maestro.Editors, Version=3.0.0.5475, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\SDK\bin\Maestro.Editors.dll</HintPath>
-    </Reference>
-    <Reference Include="Maestro.Login, Version=3.0.0.5475, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\SDK\bin\Maestro.Login.dll</HintPath>
-    </Reference>
-    <Reference Include="Maestro.Shared.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Maestro.Shared.UI\bin\Debug\Maestro.Shared.UI.dll</HintPath>
-    </Reference>
-    <Reference Include="OSGeo.MapGuide.MaestroAPI, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\SDK\bin\OSGeo.MapGuide.MaestroAPI.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
@@ -147,14 +131,30 @@
     </BootstrapperPackage>
   </ItemGroup>
   <ItemGroup>
+    <Analyzer Include="..\Maestro\packages\RefactoringEssentials.2.0.0\analyzers\dotnet\RefactoringEssentials.dll" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Maestro.Editors\Maestro.Editors.csproj">
+      <Project>{5ad2cdba-952e-4148-98a1-31d2e0d540d5}</Project>
+      <Name>Maestro.Editors</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\Maestro.Login\Maestro.Login.csproj">
+      <Project>{07588440-5f9f-4c30-aa06-9cf30ba6dde6}</Project>
+      <Name>Maestro.Login</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\Maestro.Shared.UI\Maestro.Shared.UI.csproj">
+      <Project>{cfd19053-2172-41d3-8460-0fd2123a1e88}</Project>
+      <Name>Maestro.Shared.UI</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
+      <Project>{80fa3158-8b5f-48d1-a393-0378afe48a7e}</Project>
+      <Name>OSGeo.MapGuide.MaestroAPI</Name>
+    </ProjectReference>
     <ProjectReference Include="..\OSGeo.MapGuide.ObjectModels\OSGeo.MapGuide.ObjectModels.csproj">
       <Project>{48c5eb23-45ae-4c4c-8fab-635428ae8ca1}</Project>
       <Name>OSGeo.MapGuide.ObjectModels</Name>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup>
-    <Analyzer Include="..\Maestro\packages\RefactoringEssentials.2.0.0\analyzers\dotnet\RefactoringEssentials.dll" />
-  </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.



More information about the mapguide-commits mailing list