[mapguide-commits] r5669 - in trunk/Tools/Maestro/Maestro.Base: . Commands/SiteExplorer Properties Resources

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 31 07:19:12 EDT 2011


Author: jng
Date: 2011-03-31 04:19:12 -0700 (Thu, 31 Mar 2011)
New Revision: 5669

Added:
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/SaveResourceContentToDiskCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Resources/server--arrow.png
Modified:
   trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
   trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
Log:
#1646: Add save resource to xml file command. Also add an icon for copy/move resource to another server command


Added: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/SaveResourceContentToDiskCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/SaveResourceContentToDiskCommand.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/SaveResourceContentToDiskCommand.cs	2011-03-31 11:19:12 UTC (rev 5669)
@@ -0,0 +1,53 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ICSharpCode.Core;
+using Maestro.Base.UI;
+using Maestro.Base.Services;
+using Maestro.Shared.UI;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+    internal class SaveResourceContentToDiskCommand : AbstractMenuCommand
+    {
+        public override void Run()
+        {
+            var wb = Workbench.Instance;
+            var exp = wb.ActiveSiteExplorer;
+            var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+            var conn = connMgr.GetConnection(exp.ConnectionName);
+
+            if (exp.SelectedItems.Length == 1)
+            {
+                using (var diag = DialogFactory.SaveFile())
+                {
+                    if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+                    {
+                        var res = conn.ResourceService.GetResource(exp.SelectedItems[0].ResourceId);
+                        System.IO.File.WriteAllText(diag.FileName, res.Serialize());
+                        MessageService.ShowMessage(string.Format(Properties.Resources.SavedResource, diag.FileName));
+                    }
+                }
+            }
+        }
+    }
+}

Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin	2011-03-29 13:34:26 UTC (rev 5668)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin	2011-03-31 11:19:12 UTC (rev 5669)
@@ -508,9 +508,15 @@
                       label="${res:SiteExplorer_Migrate}"
                       class="Maestro.Base.Commands.SiteExplorer.MigrateResourceCommand" />
             <MenuItem id="CopyMoveToServer"
+                      icon="server__arrow"
                       label="${res:SiteExplorer_CopyMoveToServer}"
                       class="Maestro.Base.Commands.SiteExplorer.CopyMoveToAnotherServerCommand" />
             <MenuItem type="Separator" />
+            <MenuItem id="SaveResource"
+                      label="${res:SiteExplorer_SaveResource}"
+                      icon="disk"
+                      class="Maestro.Base.Commands.SiteExplorer.SaveResourceContentToDiskCommand" />
+            <MenuItem type="Separator" />
             <MenuItem id="Repoint"
                       icon="document__arrow"
                       label="${res:SiteExplorer_Repoint}"

Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2011-03-29 13:34:26 UTC (rev 5668)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2011-03-31 11:19:12 UTC (rev 5669)
@@ -100,6 +100,7 @@
     <Compile Include="Commands\SaveAllCommand.cs" />
     <Compile Include="Commands\SaveResourceAsCommand.cs" />
     <Compile Include="Commands\SaveResourceCommand.cs" />
+    <Compile Include="Commands\SiteExplorer\SaveResourceContentToDiskCommand.cs" />
     <Compile Include="Commands\ServerMonitorCommand.cs" />
     <Compile Include="Commands\SiteAdministratorCommand.cs" />
     <Compile Include="Commands\SiteExplorer\DeleteSelectedItemsCommand.cs" />
@@ -360,6 +361,7 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="Maestro.Base.addin" />
+    <None Include="Resources\server--arrow.png" />
     <None Include="Resources\document--arrow.png" />
     <None Include="Resources\disks.png" />
     <None Include="Resources\box--plus.png" />

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2011-03-29 13:34:26 UTC (rev 5668)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2011-03-31 11:19:12 UTC (rev 5669)
@@ -1448,6 +1448,15 @@
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Saved resource content to {0}.
+        /// </summary>
+        internal static string SavedResource {
+            get {
+                return ResourceManager.GetString("SavedResource", resourceCulture);
+            }
+        }
+        
         internal static System.Drawing.Bitmap scissors_blue {
             get {
                 object obj = ResourceManager.GetObject("scissors_blue", resourceCulture);
@@ -1489,6 +1498,13 @@
             }
         }
         
+        internal static System.Drawing.Bitmap server__arrow {
+            get {
+                object obj = ResourceManager.GetObject("server__arrow", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Server Status Monitor.
         /// </summary>
@@ -1625,6 +1641,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Save Resource XML.
+        /// </summary>
+        internal static string SiteExplorer_SaveResource {
+            get {
+                return ResourceManager.GetString("SiteExplorer_SaveResource", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Package folder.
         /// </summary>
         internal static string SiteExplorer_SelectedFolder_CreatePackage {

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2011-03-29 13:34:26 UTC (rev 5668)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2011-03-31 11:19:12 UTC (rev 5669)
@@ -880,4 +880,13 @@
   <data name="SiteAdministrator" xml:space="preserve">
     <value>Site Administrator</value>
   </data>
+  <data name="SavedResource" xml:space="preserve">
+    <value>Saved resource content to {0}</value>
+  </data>
+  <data name="SiteExplorer_SaveResource" xml:space="preserve">
+    <value>Save Resource XML</value>
+  </data>
+  <data name="server__arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\server--arrow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>
\ No newline at end of file

Added: trunk/Tools/Maestro/Maestro.Base/Resources/server--arrow.png
===================================================================
(Binary files differ)


Property changes on: trunk/Tools/Maestro/Maestro.Base/Resources/server--arrow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the mapguide-commits mailing list