[mapguide-commits] r5327 - in sandbox/maestro-3.0: Maestro.Base
Maestro.Base/Commands/SiteExplorer Maestro.Base/Properties
Maestro.Base/Services Maestro.Base/UI Maestro.Editors
Maestro.Editors/LayerDefinition/Vector
Maestro.Editors/MapDefinition Maestro.Editors/Migration
OSGeo.MapGuide.MaestroAPI/CrossConnection
OSGeo.MapGuide.MaestroAPI.Http
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Oct 26 03:58:48 EDT 2010
Author: jng
Date: 2010-10-26 00:58:48 -0700 (Tue, 26 Oct 2010)
New Revision: 5327
Added:
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/CopyMoveToAnotherServerCommand.cs
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateResourceCommand.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.resx
sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.resx
Removed:
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateSelectedResourcesCommand.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.cs
sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.resx
Modified:
sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs
sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx
sandbox/maestro-3.0/Maestro.Base/Services/ServerConnectionManager.cs
sandbox/maestro-3.0/Maestro.Base/UI/OutboundRequestViewer.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
sandbox/maestro-3.0/Maestro.Editors/MapDefinition/GroupPropertiesCtrl.Designer.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlAggregateSetReader.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlFeatureSetReader.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlSqlResultReader.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/CrossConnection/ResourceMigrator.cs
Log:
3.0 sandbox changes:
- Use (read-only textbox with dialog picker) as opposed to combobox for Vector Layer settings control to workaround the known problem of databinding with chained comboboxes.
- Possible fix for #1478: Add missing case for float (System.Single) data types
- Fix #1492: Setup outbound listener for added connections
- Fix incorrect labels on group properties editor (Map Definition editor)
- #1112: Rename migrate command and affected items to something more reflective of its function (Copy/Move to another server)
- #1112: Add a "Migrate Resource" command which will copy the specified resource (and its dependents) to the target connection with the option to overwrite any existing resources of the same ids.
Copied: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/CopyMoveToAnotherServerCommand.cs (from rev 5326, sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateSelectedResourcesCommand.cs)
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/CopyMoveToAnotherServerCommand.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/CopyMoveToAnotherServerCommand.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,109 @@
+#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 ICSharpCode.Core;
+using Maestro.Base.Services;
+using Maestro.Login;
+using Maestro.Editors.Migration;
+using OSGeo.MapGuide.MaestroAPI.CrossConnection;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+ internal class CopyMoveToAnotherServerCommand : AbstractCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ var svc = ServiceRegistry.GetService<ServerConnectionManager>();
+ var exp = wb.ActiveSiteExplorer;
+ if (exp.SelectedItems.Length > 0)
+ {
+ var source = svc.GetConnection(exp.ConnectionName);
+ var login = new LoginDialog();
+ if (login.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ var target = login.Connection;
+ var migrate = new CopyMoveToServerDialog(source, target);
+
+ var srcIds = new List<string>();
+ foreach (var item in exp.SelectedItems)
+ {
+ srcIds.Add(item.ResourceId);
+ }
+
+ migrate.SourceResourceIds = srcIds.ToArray();
+
+ if (migrate.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ int affected = DoMigrate(source, target, migrate);
+ MessageService.ShowMessage(string.Format(Properties.Resources.ItemsMigrated, affected));
+ if (affected > 0 && migrate.SelectedAction == MigrationAction.Move)
+ {
+ var parent = exp.SelectedItems[0].Parent;
+ if (parent != null)
+ exp.RefreshModel(parent.ResourceId);
+ else
+ exp.RefreshModel("Library://");
+ }
+ }
+ }
+ }
+ }
+
+ private static int DoMigrate(OSGeo.MapGuide.MaestroAPI.IServerConnection source, OSGeo.MapGuide.MaestroAPI.IServerConnection target, CopyMoveToServerDialog migrate)
+ {
+ var diag = new ProgressDialog();
+ diag.CancelAbortsThread = true;
+ var method = new ProgressDialog.DoBackgroundWork((worker, e, args) =>
+ {
+ var src = (IServerConnection)args[0];
+ var dst = (IServerConnection)args[1];
+ var ids = (string[])args[2];
+ var folder = (string)args[3];
+ var overwrite = (bool)args[4];
+ var act = (MigrationAction)args[5];
+
+ var cb = new LengthyOperationProgressCallBack((sender, cbe) =>
+ {
+ worker.ReportProgress(cbe.Progress, cbe.StatusMessage);
+ });
+
+ var migrator = new ResourceMigrator(source, target);
+ int affected = 0;
+ switch (act)
+ {
+ case MigrationAction.Copy:
+ affected = migrator.CopyResources(ids, folder, overwrite, cb);
+ break;
+ case MigrationAction.Move:
+ affected = migrator.MoveResources(ids, folder, overwrite, cb);
+ break;
+ }
+ return affected;
+ });
+
+ return (int)diag.RunOperationAsync(Workbench.Instance, method, source, target, migrate.SourceResourceIds, migrate.TargetFolder, migrate.OverwriteResources, migrate.SelectedAction);
+ }
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateResourceCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateResourceCommand.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateResourceCommand.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,84 @@
+#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 ICSharpCode.Core;
+using Maestro.Base.Services;
+using Maestro.Login;
+using Maestro.Editors.Migration;
+using OSGeo.MapGuide.MaestroAPI;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI.CrossConnection;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+ internal class MigrateResourceCommand : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ var svc = ServiceRegistry.GetService<ServerConnectionManager>();
+ var exp = wb.ActiveSiteExplorer;
+ if (exp.SelectedItems.Length == 1 && !exp.SelectedItems[0].IsFolder)
+ {
+ var source = svc.GetConnection(exp.ConnectionName);
+ var login = new LoginDialog();
+ if (login.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ var target = login.Connection;
+ var dlg = new MigrateDialog(source, target);
+ dlg.ResourceID = exp.SelectedItems[0].ResourceId;
+
+ if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ DoMigrate(source, target, dlg.ResourceID, dlg.DependentResources, dlg.OverwriteExisting);
+ MessageService.ShowMessage(string.Format(Properties.Resources.ResourceMigrated, exp.SelectedItems[0].ResourceId));
+ }
+ }
+ }
+ }
+
+ private void DoMigrate(IServerConnection source, IServerConnection target, string resourceId, string[] dependentResourceIds, bool overwrite)
+ {
+ var diag = new ProgressDialog();
+ diag.CancelAbortsThread = true;
+ var method = new ProgressDialog.DoBackgroundWork((worker, e, args) =>
+ {
+ var src = (IServerConnection)args[0];
+ var dst = (IServerConnection)args[1];
+ var resId = (string)args[2];
+ var dependents = (string[])args[3];
+ var overwriteExisting = (bool)args[4];
+
+ var cb = new LengthyOperationProgressCallBack((sender, cbe) =>
+ {
+ worker.ReportProgress(cbe.Progress, cbe.StatusMessage);
+ });
+
+ var migrator = new ResourceMigrator(source, target);
+ migrator.MigrateResource(resId, dependentResourceIds, overwriteExisting, cb);
+ return true;
+ });
+
+ diag.RunOperationAsync(Workbench.Instance, method, source, target, resourceId, dependentResourceIds, overwrite);
+ }
+ }
+}
Deleted: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateSelectedResourcesCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateSelectedResourcesCommand.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/MigrateSelectedResourcesCommand.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -1,109 +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 ICSharpCode.Core;
-using Maestro.Base.Services;
-using Maestro.Login;
-using Maestro.Editors.Migration;
-using OSGeo.MapGuide.MaestroAPI.CrossConnection;
-using Maestro.Shared.UI;
-using OSGeo.MapGuide.MaestroAPI;
-
-namespace Maestro.Base.Commands.SiteExplorer
-{
- internal class MigrateSelectedResourcesCommand : AbstractCommand
- {
- public override void Run()
- {
- var wb = Workbench.Instance;
- var svc = ServiceRegistry.GetService<ServerConnectionManager>();
- var exp = wb.ActiveSiteExplorer;
- if (exp.SelectedItems.Length > 0)
- {
- var source = svc.GetConnection(exp.ConnectionName);
- var login = new LoginDialog();
- if (login.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- var target = login.Connection;
- var migrate = new ResourceMigrationDialog(source, target);
-
- var srcIds = new List<string>();
- foreach (var item in exp.SelectedItems)
- {
- srcIds.Add(item.ResourceId);
- }
-
- migrate.SourceResourceIds = srcIds.ToArray();
-
- if (migrate.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- int affected = DoMigrate(source, target, migrate);
- MessageService.ShowMessage(string.Format(Properties.Resources.ItemsMigrated, affected));
- if (affected > 0 && migrate.SelectedAction == MigrationAction.Move)
- {
- var parent = exp.SelectedItems[0].Parent;
- if (parent != null)
- exp.RefreshModel(parent.ResourceId);
- else
- exp.RefreshModel("Library://");
- }
- }
- }
- }
- }
-
- private static int DoMigrate(OSGeo.MapGuide.MaestroAPI.IServerConnection source, OSGeo.MapGuide.MaestroAPI.IServerConnection target, ResourceMigrationDialog migrate)
- {
- var diag = new ProgressDialog();
- diag.CancelAbortsThread = true;
- var method = new ProgressDialog.DoBackgroundWork((worker, e, args) =>
- {
- var src = (IServerConnection)args[0];
- var dst = (IServerConnection)args[1];
- var ids = (string[])args[2];
- var folder = (string)args[3];
- var overwrite = (bool)args[4];
- var act = (MigrationAction)args[5];
-
- var cb = new LengthyOperationProgressCallBack((sender, cbe) =>
- {
- worker.ReportProgress(cbe.Progress, cbe.StatusMessage);
- });
-
- var migrator = new ResourceMigrator(source, target);
- int affected = 0;
- switch (act)
- {
- case MigrationAction.Copy:
- affected = migrator.CopyResources(ids, folder, overwrite, cb);
- break;
- case MigrationAction.Move:
- affected = migrator.MoveResources(ids, folder, overwrite, cb);
- break;
- }
- return affected;
- });
-
- return (int)diag.RunOperationAsync(Workbench.Instance, method, source, target, migrate.SourceResourceIds, migrate.TargetFolder, migrate.OverwriteResources, migrate.SelectedAction);
- }
- }
-}
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-10-26 07:58:48 UTC (rev 5327)
@@ -423,8 +423,11 @@
</Condition>
<MenuItem type="Separator" />
<MenuItem id="Migrate"
- label="${res:SiteExplorer_MigrateResources}"
- class="Maestro.Base.Commands.SiteExplorer.MigrateSelectedResourcesCommand" />
+ label="${res:SiteExplorer_Migrate}"
+ class="Maestro.Base.Commands.SiteExplorer.MigrateResourceCommand" />
+ <MenuItem id="CopyMoveToServer"
+ label="${res:SiteExplorer_CopyMoveToServer}"
+ class="Maestro.Base.Commands.SiteExplorer.CopyMoveToAnotherServerCommand" />
<MenuItem type="Separator" />
<MenuItem id="Validate"
icon="tick"
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-10-26 07:58:48 UTC (rev 5327)
@@ -75,7 +75,8 @@
<Compile Include="Commands\ServerMonitorCommand.cs" />
<Compile Include="Commands\SiteExplorer\DeleteSelectedItemsCommand.cs" />
<Compile Include="Commands\SiteExplorer\DisconnectCommand.cs" />
- <Compile Include="Commands\SiteExplorer\MigrateSelectedResourcesCommand.cs" />
+ <Compile Include="Commands\SiteExplorer\CopyMoveToAnotherServerCommand.cs" />
+ <Compile Include="Commands\SiteExplorer\MigrateResourceCommand.cs" />
<Compile Include="Commands\SiteExplorer\NewFolderCommand.cs" />
<Compile Include="Commands\SiteExplorer\OpenResourceCommand.cs" />
<Compile Include="Commands\SiteExplorer\OpenWithXmlEditorCommand.cs" />
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -1035,6 +1035,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Resource Migrated: {0}.
+ /// </summary>
+ internal static string ResourceMigrated {
+ get {
+ return ResourceManager.GetString("ResourceMigrated", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Failed to decode the current bounds,
///you must re-enter the epsg code in the SRS tag manually.
///Error message: {0}..
@@ -1269,6 +1278,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Copy/Move selected items to another server.
+ /// </summary>
+ internal static string SiteExplorer_CopyMoveToServer {
+ get {
+ return ResourceManager.GetString("SiteExplorer_CopyMoveToServer", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Disconnect.
/// </summary>
internal static string SiteExplorer_Disconnect {
@@ -1278,11 +1296,11 @@
}
/// <summary>
- /// Looks up a localized string similar to Migrate Selected Resources.
+ /// Looks up a localized string similar to Migrate.
/// </summary>
- internal static string SiteExplorer_MigrateResources {
+ internal static string SiteExplorer_Migrate {
get {
- return ResourceManager.GetString("SiteExplorer_MigrateResources", resourceCulture);
+ return ResourceManager.GetString("SiteExplorer_Migrate", resourceCulture);
}
}
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-10-26 07:58:48 UTC (rev 5327)
@@ -742,8 +742,8 @@
<data name="ItemsMigrated" xml:space="preserve">
<value>{0} items migrated</value>
</data>
- <data name="SiteExplorer_MigrateResources" xml:space="preserve">
- <value>Migrate Selected Resources</value>
+ <data name="SiteExplorer_CopyMoveToServer" xml:space="preserve">
+ <value>Copy/Move selected items to another server</value>
</data>
<data name="FilterExecutables" xml:space="preserve">
<value>Executables|*.exe</value>
@@ -760,4 +760,10 @@
<data name="ServerMonitor" xml:space="preserve">
<value>Server Status Monitor</value>
</data>
+ <data name="ResourceMigrated" xml:space="preserve">
+ <value>Resource Migrated: {0}</value>
+ </data>
+ <data name="SiteExplorer_Migrate" xml:space="preserve">
+ <value>Migrate</value>
+ </data>
</root>
\ No newline at end of file
Modified: sandbox/maestro-3.0/Maestro.Base/Services/ServerConnectionManager.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Services/ServerConnectionManager.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/Services/ServerConnectionManager.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -22,14 +22,28 @@
using System.Text;
using OSGeo.MapGuide.MaestroAPI;
using ICSharpCode.Core;
+using System.ComponentModel;
namespace Maestro.Base.Services
{
public delegate void ServerConnectionEventHandler(object sender, string name);
+ public delegate void ServerConnectionRemovingEventHandler(object sender, ServerConnectionRemovingEventArgs e);
+ public class ServerConnectionRemovingEventArgs : CancelEventArgs
+ {
+ public ServerConnectionRemovingEventArgs(string name)
+ {
+ this.ConnectionName = name;
+ base.Cancel = false;
+ }
+
+ public string ConnectionName { get; set; }
+ }
+
public class ServerConnectionManager : ServiceBase
{
public event ServerConnectionEventHandler ConnectionAdded;
+ public event ServerConnectionRemovingEventHandler ConnectionRemoving;
public event ServerConnectionEventHandler ConnectionRemoved;
private Dictionary<string, IServerConnection> _connections = new Dictionary<string, IServerConnection>();
@@ -65,11 +79,20 @@
{
if (_connections.ContainsKey(name))
{
+ var removing = this.ConnectionRemoving;
+ var ce = new ServerConnectionRemovingEventArgs(name);
+ if (removing != null)
+ removing(this, ce);
+
+ if (ce.Cancel)
+ return null;
+
IServerConnection conn = _connections[name];
_connections.Remove(name);
- var handler = this.ConnectionRemoved;
- if (handler != null)
- handler(this, name);
+
+ var removed = this.ConnectionRemoved;
+ if (removed != null)
+ removed(this, name);
return conn;
}
return null;
Modified: sandbox/maestro-3.0/Maestro.Base/UI/OutboundRequestViewer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/OutboundRequestViewer.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Base/UI/OutboundRequestViewer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -37,21 +37,23 @@
{
InitializeComponent();
this.Title = this.Description = Properties.Resources.Content_OutboundRequests;
+
+ var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+ connMgr.ConnectionAdded += (s, args) =>
+ {
+ var conn = connMgr.GetConnection(args);
+ conn.RequestDispatched += OnRequestDispatched;
+ };
+ connMgr.ConnectionRemoving += (s, ce) =>
+ {
+ var conn = connMgr.GetConnection(ce.ConnectionName);
+ conn.RequestDispatched -= OnRequestDispatched;
+ };
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
-
- //TODO: Re-evaluate design when we decide to support multiple site connections
- var wb = Workbench.Instance;
- var exp = wb.ActiveSiteExplorer;
- if (exp != null)
- {
- var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
- var conn = connMgr.GetConnection(exp.ConnectionName);
- conn.RequestDispatched += new OSGeo.MapGuide.MaestroAPI.RequestEventHandler(OnRequestDispatched);
- }
}
void OnRequestDispatched(object sender, OSGeo.MapGuide.MaestroAPI.RequestEventArgs e)
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.Designer.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -32,10 +32,12 @@
this.txtFeatureSource = new System.Windows.Forms.TextBox();
this.btnBrowseFeatureSource = new System.Windows.Forms.Button();
this.grpFeatureClass = new System.Windows.Forms.GroupBox();
- this.cmbGeometry = new System.Windows.Forms.ComboBox();
- this.cmbSchema = new System.Windows.Forms.ComboBox();
+ this.btnBrowseGeometry = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
+ this.btnBrowseSchema = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
+ this.txtGeometry = new System.Windows.Forms.TextBox();
+ this.txtFeatureClass = new System.Windows.Forms.TextBox();
this.grpLayerSettings = new System.Windows.Forms.GroupBox();
this.btnEditTooltip = new System.Windows.Forms.Button();
this.btnEditHyperlink = new System.Windows.Forms.Button();
@@ -95,10 +97,12 @@
//
this.grpFeatureClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.grpFeatureClass.Controls.Add(this.cmbGeometry);
- this.grpFeatureClass.Controls.Add(this.cmbSchema);
+ this.grpFeatureClass.Controls.Add(this.btnBrowseGeometry);
this.grpFeatureClass.Controls.Add(this.label3);
+ this.grpFeatureClass.Controls.Add(this.btnBrowseSchema);
this.grpFeatureClass.Controls.Add(this.label2);
+ this.grpFeatureClass.Controls.Add(this.txtGeometry);
+ this.grpFeatureClass.Controls.Add(this.txtFeatureClass);
this.grpFeatureClass.Location = new System.Drawing.Point(17, 46);
this.grpFeatureClass.Name = "grpFeatureClass";
this.grpFeatureClass.Size = new System.Drawing.Size(423, 81);
@@ -106,47 +110,66 @@
this.grpFeatureClass.TabStop = false;
this.grpFeatureClass.Text = "Feature Class";
//
- // cmbGeometry
+ // btnBrowseGeometry
//
- this.cmbGeometry.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.cmbGeometry.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbGeometry.FormattingEnabled = true;
- this.cmbGeometry.Location = new System.Drawing.Point(121, 47);
- this.cmbGeometry.Name = "cmbGeometry";
- this.cmbGeometry.Size = new System.Drawing.Size(286, 21);
- this.cmbGeometry.TabIndex = 3;
+ this.btnBrowseGeometry.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowseGeometry.Location = new System.Drawing.Point(377, 42);
+ this.btnBrowseGeometry.Name = "btnBrowseGeometry";
+ this.btnBrowseGeometry.Size = new System.Drawing.Size(30, 23);
+ this.btnBrowseGeometry.TabIndex = 12;
+ this.btnBrowseGeometry.Text = "...";
+ this.btnBrowseGeometry.UseVisualStyleBackColor = true;
+ this.btnBrowseGeometry.Click += new System.EventHandler(this.btnBrowseGeometry_Click);
//
- // cmbSchema
- //
- this.cmbSchema.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.cmbSchema.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbSchema.FormattingEnabled = true;
- this.cmbSchema.Location = new System.Drawing.Point(121, 19);
- this.cmbSchema.Name = "cmbSchema";
- this.cmbSchema.Size = new System.Drawing.Size(286, 21);
- this.cmbSchema.TabIndex = 2;
- this.cmbSchema.SelectedIndexChanged += new System.EventHandler(this.cmbSchema_SelectedIndexChanged);
- //
// label3
//
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(15, 50);
+ this.label3.Location = new System.Drawing.Point(15, 47);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(94, 13);
this.label3.TabIndex = 1;
this.label3.Text = "Geometry Property";
//
+ // btnBrowseSchema
+ //
+ this.btnBrowseSchema.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowseSchema.Location = new System.Drawing.Point(377, 17);
+ this.btnBrowseSchema.Name = "btnBrowseSchema";
+ this.btnBrowseSchema.Size = new System.Drawing.Size(30, 23);
+ this.btnBrowseSchema.TabIndex = 11;
+ this.btnBrowseSchema.Text = "...";
+ this.btnBrowseSchema.UseVisualStyleBackColor = true;
+ this.btnBrowseSchema.Click += new System.EventHandler(this.btnBrowseSchema_Click);
+ //
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 22);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(46, 13);
+ this.label2.Size = new System.Drawing.Size(71, 13);
this.label2.TabIndex = 0;
- this.label2.Text = "Schema";
+ this.label2.Text = "Feature Class";
//
+ // txtGeometry
+ //
+ this.txtGeometry.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtGeometry.Location = new System.Drawing.Point(121, 44);
+ this.txtGeometry.Name = "txtGeometry";
+ this.txtGeometry.ReadOnly = true;
+ this.txtGeometry.Size = new System.Drawing.Size(250, 20);
+ this.txtGeometry.TabIndex = 10;
+ //
+ // txtFeatureClass
+ //
+ this.txtFeatureClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFeatureClass.Location = new System.Drawing.Point(121, 19);
+ this.txtFeatureClass.Name = "txtFeatureClass";
+ this.txtFeatureClass.ReadOnly = true;
+ this.txtFeatureClass.Size = new System.Drawing.Size(250, 20);
+ this.txtFeatureClass.TabIndex = 9;
+ //
// grpLayerSettings
//
this.grpLayerSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -277,8 +300,6 @@
private System.Windows.Forms.TextBox txtFeatureSource;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox grpFeatureClass;
- private System.Windows.Forms.ComboBox cmbGeometry;
- private System.Windows.Forms.ComboBox cmbSchema;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox grpLayerSettings;
@@ -291,5 +312,9 @@
private System.Windows.Forms.Button btnEditTooltip;
private System.Windows.Forms.Button btnEditHyperlink;
private System.Windows.Forms.Button btnEditFilter;
+ private System.Windows.Forms.Button btnBrowseGeometry;
+ private System.Windows.Forms.Button btnBrowseSchema;
+ private System.Windows.Forms.TextBox txtGeometry;
+ private System.Windows.Forms.TextBox txtFeatureClass;
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -59,8 +59,8 @@
TextBoxBinder.BindText(txtFeatureSource, _vl, "ResourceId");
- ComboBoxBinder.BindSelectedIndexChanged(cmbSchema, "SelectedItem", _vl, "FeatureName");
- ComboBoxBinder.BindSelectedIndexChanged(cmbGeometry, "SelectedItem", _vl, "Geometry");
+ TextBoxBinder.BindText(txtFeatureClass, _vl, "FeatureName");
+ TextBoxBinder.BindText(txtGeometry, _vl, "Geometry");
TextBoxBinder.BindText(txtFilter, _vl, "Filter");
TextBoxBinder.BindText(txtHyperlink, _vl, "Url");
TextBoxBinder.BindText(txtTooltip, _vl, "ToolTip");
@@ -69,6 +69,26 @@
_vl.PropertyChanged += OnVectorLayerPropertyChanged;
}
+ protected override void OnLoad(EventArgs e)
+ {
+ //Init cached schemas and selected class
+ if (!string.IsNullOrEmpty(txtFeatureClass.Text))
+ {
+ if (_cachedDesc == null)
+ _cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
+
+ foreach (var cls in _cachedDesc.Classes)
+ {
+ if (cls.QualifiedNameDecoded.Equals(txtFeatureClass.Text))
+ {
+ _selectedClass = cls;
+ OnFeatureClassChanged();
+ break;
+ }
+ }
+ }
+ }
+
void OnVectorLayerPropertyChanged(object sender, PropertyChangedEventArgs e)
{
OnResourceChanged();
@@ -88,37 +108,8 @@
private void txtFeatureSource_TextChanged(object sender, EventArgs e)
{
_cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
- List<string> schemas = new List<string>();
- foreach (var sc in _cachedDesc.Classes)
- {
- schemas.Add(sc.QualifiedName);
- }
- cmbSchema.DataSource = schemas;
}
- private void cmbSchema_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (cmbSchema.SelectedItem != null)
- {
- var name = cmbSchema.SelectedItem.ToString();
- foreach (var sc in _cachedDesc.Classes)
- {
- if (name == sc.QualifiedName)
- {
- List<string> geoms = new List<string>();
- foreach (var col in sc.Columns)
- {
- if (col.IsGeometry)
- geoms.Add(col.Name);
- }
- cmbGeometry.DataSource = geoms;
- break;
- }
- }
- OnFeatureClassChanged();
- }
- }
-
internal event EventHandler FeatureClassChanged;
private void OnFeatureClassChanged()
@@ -144,19 +135,11 @@
get { return txtFeatureSource.Text; }
}
+ private ClassDefinition _selectedClass;
+
internal ClassDefinition GetSelectedClass()
{
- if (cmbSchema.SelectedItem != null)
- {
- foreach (var schema in _cachedDesc.Classes)
- {
- if (schema.QualifiedName == cmbSchema.SelectedItem.ToString())
- {
- return schema;
- }
- }
- }
- return null;
+ return _selectedClass;
}
private IFeatureSource _cachedFs;
@@ -210,5 +193,62 @@
}
}
}
+
+ private void btnBrowseSchema_Click(object sender, EventArgs e)
+ {
+ var item = GenericItemSelectionDialog.SelectItem(null, null, _cachedDesc.Classes, "QualifiedNameDecoded", "QualifiedNameDecoded");
+ if (item != null)
+ {
+ txtFeatureClass.Text = item.QualifiedNameDecoded;
+ _selectedClass = item;
+
+ //See if geometry needs invalidation
+ bool invalidate = true;
+ foreach (var col in item.Columns)
+ {
+ if (col.IsGeometry && col.Name.Equals(txtGeometry.Text))
+ {
+ invalidate = false;
+ break;
+ }
+ }
+ if (invalidate)
+ {
+ txtGeometry.Text = string.Empty;
+ }
+
+ //See if we can auto-assign geometry
+ List<FeatureSetColumn> geoms = new List<FeatureSetColumn>();
+ foreach (var col in _selectedClass.Columns)
+ {
+ if (col.IsGeometry)
+ geoms.Add(col);
+ }
+
+ if (geoms.Count == 1)
+ txtGeometry.Text = geoms[0].Name;
+
+ OnFeatureClassChanged();
+ }
+ }
+
+ private void btnBrowseGeometry_Click(object sender, EventArgs e)
+ {
+ if (_selectedClass != null)
+ {
+ List<FeatureSetColumn> geoms = new List<FeatureSetColumn>();
+ foreach (var col in _selectedClass.Columns)
+ {
+ if (col.IsGeometry)
+ geoms.Add(col);
+ }
+
+ var item = GenericItemSelectionDialog.SelectItem(null, null, geoms.ToArray(), "Name", "Name");
+ if (item != null)
+ {
+ txtGeometry.Text = item.Name;
+ }
+ }
+ }
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj 2010-10-26 07:58:48 UTC (rev 5327)
@@ -486,12 +486,18 @@
</Compile>
<Compile Include="MapDefinition\MapTreeModels.cs" />
<Compile Include="MapDefinition\ScaleListGenerator.cs" />
- <Compile Include="Migration\ResourceMigrationDialog.cs">
+ <Compile Include="Migration\CopyMoveToServerDialog.cs">
<SubType>Form</SubType>
</Compile>
- <Compile Include="Migration\ResourceMigrationDialog.Designer.cs">
- <DependentUpon>ResourceMigrationDialog.cs</DependentUpon>
+ <Compile Include="Migration\CopyMoveToServerDialog.Designer.cs">
+ <DependentUpon>CopyMoveToServerDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="Migration\MigrateDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Migration\MigrateDialog.Designer.cs">
+ <DependentUpon>MigrateDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="PrintLayout\LogoDialog.cs">
<SubType>Form</SubType>
</Compile>
@@ -862,9 +868,12 @@
<DependentUpon>MapSettingsSectionCtrl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
- <EmbeddedResource Include="Migration\ResourceMigrationDialog.resx">
- <DependentUpon>ResourceMigrationDialog.cs</DependentUpon>
+ <EmbeddedResource Include="Migration\CopyMoveToServerDialog.resx">
+ <DependentUpon>CopyMoveToServerDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Migration\MigrateDialog.resx">
+ <DependentUpon>MigrateDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="PrintLayout\LogoDialog.resx">
<DependentUpon>LogoDialog.cs</DependentUpon>
</EmbeddedResource>
Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/GroupPropertiesCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/GroupPropertiesCtrl.Designer.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/GroupPropertiesCtrl.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -61,9 +61,9 @@
this.chkExpanded.AutoSize = true;
this.chkExpanded.Location = new System.Drawing.Point(18, 127);
this.chkExpanded.Name = "chkExpanded";
- this.chkExpanded.Size = new System.Drawing.Size(228, 17);
+ this.chkExpanded.Size = new System.Drawing.Size(231, 17);
this.chkExpanded.TabIndex = 14;
- this.chkExpanded.Text = "Layer is expanded in the legend (if themed)";
+ this.chkExpanded.Text = "Group is expanded in the legend (if themed)";
this.chkExpanded.UseVisualStyleBackColor = true;
//
// chkLegendVisible
@@ -71,9 +71,9 @@
this.chkLegendVisible.AutoSize = true;
this.chkLegendVisible.Location = new System.Drawing.Point(18, 103);
this.chkLegendVisible.Name = "chkLegendVisible";
- this.chkLegendVisible.Size = new System.Drawing.Size(183, 17);
+ this.chkLegendVisible.Size = new System.Drawing.Size(186, 17);
this.chkLegendVisible.TabIndex = 13;
- this.chkLegendVisible.Text = "Layer is shown in the map legend";
+ this.chkLegendVisible.Text = "Group is shown in the map legend";
this.chkLegendVisible.UseVisualStyleBackColor = true;
//
// chkVisible
@@ -81,9 +81,9 @@
this.chkVisible.AutoSize = true;
this.chkVisible.Location = new System.Drawing.Point(18, 80);
this.chkVisible.Name = "chkVisible";
- this.chkVisible.Size = new System.Drawing.Size(141, 17);
+ this.chkVisible.Size = new System.Drawing.Size(144, 17);
this.chkVisible.TabIndex = 12;
- this.chkVisible.Text = "Layer is visible at startup";
+ this.chkVisible.Text = "Group is visible at startup";
this.chkVisible.UseVisualStyleBackColor = true;
//
// txtLegendLabel
Copied: sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.Designer.cs (from rev 5326, sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.Designer.cs)
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.Designer.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,263 @@
+namespace Maestro.Editors.Migration
+{
+ partial class CopyMoveToServerDialog
+ {
+ /// <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 Windows Form 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.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.lstResources = new System.Windows.Forms.ListBox();
+ this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.btnAddResource = new System.Windows.Forms.ToolStripButton();
+ this.btnAddFolder = new System.Windows.Forms.ToolStripButton();
+ this.btnRemove = new System.Windows.Forms.ToolStripButton();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.btnBrowseTarget = new System.Windows.Forms.Button();
+ this.txtTargetFolder = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.chkOverwrite = new System.Windows.Forms.CheckBox();
+ this.cmbAction = new System.Windows.Forms.ComboBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.groupBox1.SuspendLayout();
+ this.toolStrip1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.lstResources);
+ this.groupBox1.Controls.Add(this.toolStrip1);
+ this.groupBox1.Location = new System.Drawing.Point(13, 13);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(521, 154);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Source";
+ //
+ // lstResources
+ //
+ this.lstResources.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lstResources.FormattingEnabled = true;
+ this.lstResources.Location = new System.Drawing.Point(3, 41);
+ this.lstResources.Name = "lstResources";
+ this.lstResources.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
+ this.lstResources.Size = new System.Drawing.Size(515, 108);
+ this.lstResources.TabIndex = 1;
+ this.lstResources.SelectedIndexChanged += new System.EventHandler(this.lstResources_SelectedIndexChanged);
+ //
+ // toolStrip1
+ //
+ this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnAddResource,
+ this.btnAddFolder,
+ this.btnRemove});
+ this.toolStrip1.Location = new System.Drawing.Point(3, 16);
+ this.toolStrip1.Name = "toolStrip1";
+ this.toolStrip1.Size = new System.Drawing.Size(515, 25);
+ this.toolStrip1.TabIndex = 0;
+ this.toolStrip1.Text = "toolStrip1";
+ //
+ // btnAddResource
+ //
+ this.btnAddResource.Image = global::Maestro.Editors.Properties.Resources.document__plus;
+ this.btnAddResource.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnAddResource.Name = "btnAddResource";
+ this.btnAddResource.Size = new System.Drawing.Size(100, 22);
+ this.btnAddResource.Text = "Add Resource";
+ this.btnAddResource.Click += new System.EventHandler(this.btnAddResource_Click);
+ //
+ // btnAddFolder
+ //
+ this.btnAddFolder.Image = global::Maestro.Editors.Properties.Resources.folder__plus;
+ this.btnAddFolder.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnAddFolder.Name = "btnAddFolder";
+ this.btnAddFolder.Size = new System.Drawing.Size(85, 22);
+ this.btnAddFolder.Text = "Add Folder";
+ this.btnAddFolder.Click += new System.EventHandler(this.btnAddFolder_Click);
+ //
+ // btnRemove
+ //
+ this.btnRemove.Enabled = false;
+ this.btnRemove.Image = global::Maestro.Editors.Properties.Resources.cross_script;
+ this.btnRemove.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnRemove.Name = "btnRemove";
+ this.btnRemove.Size = new System.Drawing.Size(70, 22);
+ this.btnRemove.Text = "Remove";
+ this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.btnBrowseTarget);
+ this.groupBox2.Controls.Add(this.txtTargetFolder);
+ this.groupBox2.Controls.Add(this.label1);
+ this.groupBox2.Location = new System.Drawing.Point(13, 173);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(521, 61);
+ this.groupBox2.TabIndex = 1;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Target";
+ //
+ // btnBrowseTarget
+ //
+ this.btnBrowseTarget.Location = new System.Drawing.Point(478, 24);
+ this.btnBrowseTarget.Name = "btnBrowseTarget";
+ this.btnBrowseTarget.Size = new System.Drawing.Size(27, 23);
+ this.btnBrowseTarget.TabIndex = 2;
+ this.btnBrowseTarget.Text = "...";
+ this.btnBrowseTarget.UseVisualStyleBackColor = true;
+ this.btnBrowseTarget.Click += new System.EventHandler(this.btnBrowseTarget_Click);
+ //
+ // txtTargetFolder
+ //
+ this.txtTargetFolder.Location = new System.Drawing.Point(78, 26);
+ this.txtTargetFolder.Name = "txtTargetFolder";
+ this.txtTargetFolder.ReadOnly = true;
+ this.txtTargetFolder.Size = new System.Drawing.Size(394, 20);
+ this.txtTargetFolder.TabIndex = 1;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(26, 29);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(36, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Folder";
+ //
+ // btnOK
+ //
+ this.btnOK.Enabled = false;
+ this.btnOK.Location = new System.Drawing.Point(378, 352);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 2;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point(459, 352);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 3;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.chkOverwrite);
+ this.groupBox3.Controls.Add(this.cmbAction);
+ this.groupBox3.Controls.Add(this.label2);
+ this.groupBox3.Location = new System.Drawing.Point(13, 240);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(521, 106);
+ this.groupBox3.TabIndex = 4;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Migration Options";
+ //
+ // chkOverwrite
+ //
+ this.chkOverwrite.AutoSize = true;
+ this.chkOverwrite.Location = new System.Drawing.Point(29, 64);
+ this.chkOverwrite.Name = "chkOverwrite";
+ this.chkOverwrite.Size = new System.Drawing.Size(212, 17);
+ this.chkOverwrite.TabIndex = 2;
+ this.chkOverwrite.Text = "Overwrite Resources of the same name";
+ this.chkOverwrite.UseVisualStyleBackColor = true;
+ //
+ // cmbAction
+ //
+ this.cmbAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbAction.FormattingEnabled = true;
+ this.cmbAction.Location = new System.Drawing.Point(130, 26);
+ this.cmbAction.Name = "cmbAction";
+ this.cmbAction.Size = new System.Drawing.Size(121, 21);
+ this.cmbAction.TabIndex = 1;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(26, 29);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(83, 13);
+ this.label2.TabIndex = 0;
+ this.label2.Text = "Migration Action";
+ //
+ // CopyMoveToServerDialog
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(546, 387);
+ this.ControlBox = false;
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "CopyMoveToServerDialog";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Copy/Move Resources";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.toolStrip1.ResumeLayout(false);
+ this.toolStrip1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox chkOverwrite;
+ private System.Windows.Forms.ComboBox cmbAction;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.ListBox lstResources;
+ private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStripButton btnAddResource;
+ private System.Windows.Forms.ToolStripButton btnAddFolder;
+ private System.Windows.Forms.ToolStripButton btnRemove;
+ private System.Windows.Forms.Button btnBrowseTarget;
+ private System.Windows.Forms.TextBox txtTargetFolder;
+ }
+}
\ No newline at end of file
Copied: sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.cs (from rev 5326, sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.cs)
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,175 @@
+#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.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI;
+using Maestro.Editors.Generic;
+
+namespace Maestro.Editors.Migration
+{
+ public partial class CopyMoveToServerDialog : Form
+ {
+ private CopyMoveToServerDialog()
+ {
+ InitializeComponent();
+ cmbAction.DataSource = Enum.GetValues(typeof(MigrationAction));
+ }
+
+ private IServerConnection _source;
+ private IServerConnection _target;
+
+ public CopyMoveToServerDialog(IServerConnection source, IServerConnection target)
+ : this()
+ {
+ _source = source;
+ _target = target;
+ }
+
+ private void lstResources_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ EvaluateCommandState();
+ }
+
+ private void btnAddResource_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_source.ResourceService, ResourcePickerMode.OpenResource))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ if (!lstResources.Items.Contains(picker.ResourceID))
+ lstResources.Items.Add(picker.ResourceID);
+
+ EvaluateCommandState();
+ }
+ }
+ }
+
+ private void btnAddFolder_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_source.ResourceService, ResourcePickerMode.OpenFolder))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ var folderId = picker.ResourceID;
+ var list = _target.ResourceService.GetRepositoryResources(folderId);
+
+ foreach (var item in list.Children)
+ {
+ if (!item.IsFolder && !lstResources.Items.Contains(item.ResourceId))
+ lstResources.Items.Add(item.ResourceId);
+ }
+ EvaluateCommandState();
+ }
+ }
+ }
+
+ private void btnRemove_Click(object sender, EventArgs e)
+ {
+ var items = lstResources.SelectedItems;
+ if (items != null && items.Count > 0)
+ {
+ for (int i = 0; i < items.Count; i++)
+ {
+ lstResources.Items.Remove(items[i]);
+ EvaluateCommandState();
+ }
+ }
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ }
+
+ public string TargetFolder
+ {
+ get { return txtTargetFolder.Text; }
+ set { txtTargetFolder.Text = value; }
+ }
+
+ public string[] SourceResourceIds
+ {
+ get
+ {
+ List<string> resIds = new List<string>();
+ foreach (var item in lstResources.Items)
+ {
+ resIds.Add(item.ToString());
+ }
+ return resIds.ToArray();
+ }
+ set
+ {
+ lstResources.Items.Clear();
+ foreach (var resId in value)
+ {
+ lstResources.Items.Add(resId);
+ }
+ EvaluateCommandState();
+ }
+ }
+
+ public MigrationAction SelectedAction
+ {
+ get { return (MigrationAction)cmbAction.SelectedItem; }
+ set { cmbAction.SelectedItem = value ; }
+ }
+
+ public bool OverwriteResources
+ {
+ get { return chkOverwrite.Checked; }
+ set { chkOverwrite.Checked = value; }
+ }
+
+ private void btnBrowseTarget_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_target.ResourceService, ResourcePickerMode.OpenFolder))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ txtTargetFolder.Text = picker.ResourceID;
+ EvaluateCommandState();
+ }
+ }
+ }
+
+ private void EvaluateCommandState()
+ {
+ btnRemove.Enabled = (lstResources.SelectedItem != null) || (lstResources.SelectedItems != null && lstResources.SelectedItems.Count > 0);
+ btnOK.Enabled = (lstResources.Items.Count > 0) && !string.IsNullOrEmpty(txtTargetFolder.Text);
+ }
+ }
+
+ public enum MigrationAction
+ {
+ Copy,
+ Move
+ }
+}
Copied: sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.resx (from rev 5326, sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.resx)
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.resx (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/CopyMoveToServerDialog.resx 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,123 @@
+<?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>
+ <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
Added: sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.Designer.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,261 @@
+namespace Maestro.Editors.Migration
+{
+ partial class MigrateDialog
+ {
+ /// <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 Windows Form 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()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MigrateDialog));
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.chkDependencies = new System.Windows.Forms.CheckedListBox();
+ this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.btnCheckAll = new System.Windows.Forms.ToolStripButton();
+ this.btnCheckNone = new System.Windows.Forms.ToolStripButton();
+ this.btnCheckRequired = new System.Windows.Forms.ToolStripButton();
+ this.chkOverwrite = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtResourceId = new System.Windows.Forms.TextBox();
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.lblWarning = new System.Windows.Forms.Label();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.toolStrip1.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // 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.btnBrowse);
+ this.groupBox1.Controls.Add(this.txtResourceId);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Location = new System.Drawing.Point(13, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(535, 61);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Source";
+ //
+ // 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.chkDependencies);
+ this.groupBox2.Controls.Add(this.toolStrip1);
+ this.groupBox2.Location = new System.Drawing.Point(13, 79);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(535, 139);
+ this.groupBox2.TabIndex = 1;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Dependencies (Check to copy)";
+ //
+ // chkDependencies
+ //
+ this.chkDependencies.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.chkDependencies.FormattingEnabled = true;
+ this.chkDependencies.Location = new System.Drawing.Point(3, 41);
+ this.chkDependencies.Name = "chkDependencies";
+ this.chkDependencies.Size = new System.Drawing.Size(529, 94);
+ this.chkDependencies.TabIndex = 1;
+ //
+ // toolStrip1
+ //
+ this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnCheckAll,
+ this.btnCheckNone,
+ this.btnCheckRequired});
+ this.toolStrip1.Location = new System.Drawing.Point(3, 16);
+ this.toolStrip1.Name = "toolStrip1";
+ this.toolStrip1.Size = new System.Drawing.Size(529, 25);
+ this.toolStrip1.TabIndex = 0;
+ this.toolStrip1.Text = "toolStrip1";
+ //
+ // groupBox3
+ //
+ this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBox3.Controls.Add(this.chkOverwrite);
+ this.groupBox3.Location = new System.Drawing.Point(13, 224);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(535, 66);
+ this.groupBox3.TabIndex = 2;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Other Options";
+ //
+ // btnCheckAll
+ //
+ this.btnCheckAll.Image = ((System.Drawing.Image)(resources.GetObject("btnCheckAll.Image")));
+ this.btnCheckAll.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnCheckAll.Name = "btnCheckAll";
+ this.btnCheckAll.Size = new System.Drawing.Size(77, 22);
+ this.btnCheckAll.Text = "Check All";
+ this.btnCheckAll.ToolTipText = "Check all items";
+ this.btnCheckAll.Click += new System.EventHandler(this.btnCheckAll_Click);
+ //
+ // btnCheckNone
+ //
+ this.btnCheckNone.Image = ((System.Drawing.Image)(resources.GetObject("btnCheckNone.Image")));
+ this.btnCheckNone.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnCheckNone.Name = "btnCheckNone";
+ this.btnCheckNone.Size = new System.Drawing.Size(92, 22);
+ this.btnCheckNone.Text = "Check None";
+ this.btnCheckNone.ToolTipText = "Sets all dependencies to unchecked";
+ this.btnCheckNone.Click += new System.EventHandler(this.btnCheckNone_Click);
+ //
+ // btnCheckRequired
+ //
+ this.btnCheckRequired.Image = ((System.Drawing.Image)(resources.GetObject("btnCheckRequired.Image")));
+ this.btnCheckRequired.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnCheckRequired.Name = "btnCheckRequired";
+ this.btnCheckRequired.Size = new System.Drawing.Size(110, 22);
+ this.btnCheckRequired.Text = "Check Required";
+ this.btnCheckRequired.ToolTipText = "Checks resources that don\'t exist on the target connection";
+ this.btnCheckRequired.Click += new System.EventHandler(this.btnCheckRequired_Click);
+ //
+ // chkOverwrite
+ //
+ this.chkOverwrite.AutoSize = true;
+ this.chkOverwrite.Location = new System.Drawing.Point(22, 28);
+ this.chkOverwrite.Name = "chkOverwrite";
+ this.chkOverwrite.Size = new System.Drawing.Size(313, 17);
+ this.chkOverwrite.TabIndex = 0;
+ this.chkOverwrite.Text = "Overwrite existing dependent resources on target connection";
+ this.chkOverwrite.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(19, 28);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(67, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Resource ID";
+ //
+ // txtResourceId
+ //
+ this.txtResourceId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtResourceId.Location = new System.Drawing.Point(111, 25);
+ this.txtResourceId.Name = "txtResourceId";
+ this.txtResourceId.ReadOnly = true;
+ this.txtResourceId.Size = new System.Drawing.Size(387, 20);
+ this.txtResourceId.TabIndex = 1;
+ this.txtResourceId.TextChanged += new System.EventHandler(this.txtResourceId_TextChanged);
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowse.Location = new System.Drawing.Point(504, 23);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(25, 23);
+ this.btnBrowse.TabIndex = 2;
+ this.btnBrowse.Text = "...";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // btnOK
+ //
+ this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnOK.Location = new System.Drawing.Point(392, 308);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 3;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCancel.Location = new System.Drawing.Point(473, 308);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 4;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // lblWarning
+ //
+ this.lblWarning.Location = new System.Drawing.Point(35, 308);
+ this.lblWarning.Name = "lblWarning";
+ this.lblWarning.Size = new System.Drawing.Size(335, 26);
+ this.lblWarning.TabIndex = 5;
+ this.lblWarning.Text = "NOTE: Ensure that the specified resource and its dependencies are compatible with" +
+ " your target connection";
+ this.lblWarning.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // MigrateDialog
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(560, 343);
+ this.ControlBox = false;
+ this.Controls.Add(this.lblWarning);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "MigrateDialog";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Migrate Resource";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.toolStrip1.ResumeLayout(false);
+ this.toolStrip1.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.CheckedListBox chkDependencies;
+ private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.ToolStripButton btnCheckAll;
+ private System.Windows.Forms.ToolStripButton btnCheckNone;
+ private System.Windows.Forms.ToolStripButton btnCheckRequired;
+ private System.Windows.Forms.CheckBox chkOverwrite;
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.TextBox txtResourceId;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Label lblWarning;
+ }
+}
\ No newline at end of file
Added: sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,181 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI;
+using Maestro.Editors.Generic;
+using Maestro.Shared.UI;
+
+namespace Maestro.Editors.Migration
+{
+ public partial class MigrateDialog : Form
+ {
+ private MigrateDialog()
+ {
+ InitializeComponent();
+ }
+
+ private IServerConnection _source;
+ private IServerConnection _target;
+
+ public MigrateDialog(IServerConnection source, IServerConnection target)
+ : this()
+ {
+ _source = source;
+ _target = target;
+ }
+
+ public string ResourceID
+ {
+ get { return txtResourceId.Text; }
+ set { txtResourceId.Text = value; }
+ }
+
+ public string[] DependentResources
+ {
+ get
+ {
+ List<string> resIds = new List<string>();
+ foreach (var item in chkDependencies.CheckedItems)
+ {
+ resIds.Add(item.ToString());
+ }
+ return resIds.ToArray();
+ }
+ set
+ {
+ CheckNone();
+
+ foreach (var item in value)
+ {
+ var idx = chkDependencies.Items.IndexOf(item);
+ if (idx >= 0)
+ chkDependencies.SetItemChecked(idx, true);
+ }
+ }
+ }
+
+ private void CheckNone()
+ {
+ for (int i = 0; i < chkDependencies.Items.Count; i++)
+ {
+ chkDependencies.SetItemChecked(i, false);
+ }
+ }
+
+ public bool OverwriteExisting
+ {
+ get { return chkOverwrite.Checked; }
+ set { chkOverwrite.Checked = value; }
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_source.ResourceService, ResourcePickerMode.OpenResource))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ txtResourceId.Text = picker.ResourceID;
+ }
+ }
+ }
+
+ private void txtResourceId_TextChanged(object sender, EventArgs e)
+ {
+ chkDependencies.Items.Clear();
+ using (new WaitCursor(this))
+ {
+ Dictionary<string, string> resIds = new Dictionary<string, string>();
+ List<string> dependentIds = GetReverseReferences(txtResourceId.Text);
+ BuildFullDependencyList(resIds, dependentIds);
+
+ foreach (var resId in resIds.Keys)
+ {
+ chkDependencies.Items.Add(resId, false);
+ }
+
+ CheckAll();
+ }
+ }
+
+ private void BuildFullDependencyList(Dictionary<string, string> resIds, IEnumerable<string> resourceIds)
+ {
+ foreach (var id in resourceIds)
+ {
+ resIds[id] = id;
+
+ List<string> dependentIds = GetReverseReferences(id);
+
+ BuildFullDependencyList(resIds, dependentIds);
+ }
+ }
+
+ private List<string> GetReverseReferences(string id)
+ {
+ System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
+ using (var ms = _source.ResourceService.GetResourceXmlData(id))
+ {
+ doc.Load(ms);
+ }
+
+ List<KeyValuePair<System.Xml.XmlNode, string>> refs = Utility.GetResourceIdPointers(doc);
+ List<string> dependentIds = new List<string>();
+ foreach (KeyValuePair<System.Xml.XmlNode, string> s in refs)
+ if (!dependentIds.Contains(s.Value))
+ dependentIds.Add(s.Value);
+ return dependentIds;
+ }
+
+ private void CheckNonExistentItems()
+ {
+ //Now check those that do not exist on the target connection
+ for (int i = 0; i < chkDependencies.Items.Count; i++)
+ {
+ string resId = (string)chkDependencies.Items[i];
+ if (!_target.ResourceService.ResourceExists(resId))
+ {
+ chkDependencies.SetItemChecked(i, true);
+ }
+ }
+ }
+
+ private void btnCheckAll_Click(object sender, EventArgs e)
+ {
+ CheckAll();
+ }
+
+ private void CheckAll()
+ {
+ for (int i = 0; i < chkDependencies.Items.Count; i++)
+ {
+ chkDependencies.SetItemChecked(i, true);
+ }
+ }
+
+ private void btnCheckNone_Click(object sender, EventArgs e)
+ {
+ CheckNone();
+ }
+
+ private void btnCheckRequired_Click(object sender, EventArgs e)
+ {
+ using (new WaitCursor(this))
+ {
+ CheckNonExistentItems();
+ }
+ }
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.resx (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/MigrateDialog.resx 2010-10-26 07:58:48 UTC (rev 5327)
@@ -0,0 +1,169 @@
+<?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>
+ <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="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="btnCheckAll.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAG4SURBVDhPY2AYWmCNhDzDKtEzDCtFPUh3+Hx+AYZlIhvS
+ 3pX/Z1gucoZhGSmGrGJgY1gsPM/gmNPTqEfZ/+Nf5P9mWAQ0hCjwn4GRYb5wq8J2o3sBNxL/e1+N/sWz
+ XO4Sw0IRH1T9swU9GGYLngFiVP/NFsgUWql8w+1c+D/nMyF/+ZcpXmOYK5SMqnkKUNN0wTOJL4v+gmgG
+ EB8Epgn4cMyVuKy91ea32jrzf3wL5G8xTBeoxnT5JP4z0U9zf3lciPwf8SDzDwOQzzCRL5d5qtBppc0m
+ PxQ3Gf3nmyd3HyjWw1DPwIRpQC+fB0Mv7xm/m/E/lfYY/7c/H/ADxJfapPlZeofOf75Fck8YevjmATVz
+ 4A63NqAh7TxnjE45f5M4rPlf44zlf/FDGv/5V8q9YmjjXcfQD4xGgqCZy4OhifuM9AHNL8JnVf7zbpN5
+ z9jEs5uhhVOaoF64ggh2D4ZC9jOcS0VfMJaxH2EIZ9MkRjMoYPiBWB6IdRmMmNIY4pnOMGgxhAL5IAOU
+ gFgKiIWBmAeI2YCYEdlgEAcUQCB/ikMVS0LZokBaEIh5gZgLqpkZ3QBiXIlVDQDCO4gZa583FgAAAABJ
+ RU5ErkJggg==
+</value>
+ </data>
+ <data name="btnCheckNone.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAG4SURBVDhPY2AYWmCNhDzDKtEzDCtFPUh3+Hx+AYZlIhvS
+ 3pX/Z1gucoZhGSmGrGJgY1gsPM/gmNPTqEfZ/+Nf5P9mWAQ0hCjwn4GRYb5wq8J2o3sBNxL/e1+N/sWz
+ XO4Sw0IRH1T9swU9GGYLngFiVP/NFsgUWql8w+1c+D/nMyF/+ZcpXmOYK5SMqnkKUNN0wTOJL4v+gmgG
+ EB8Epgn4cMyVuKy91ea32jrzf3wL5G8xTBeoxnT5JP4z0U9zf3lciPwf8SDzDwOQzzCRL5d5qtBppc0m
+ PxQ3Gf3nmyd3HyjWw1DPwIRpQC+fB0Mv7xm/m/E/lfYY/7c/H/ADxJfapPlZeofOf75Fck8YevjmATVz
+ 4A63NqAh7TxnjE45f5M4rPlf44zlf/FDGv/5V8q9YmjjXcfQD4xGgqCZy4OhifuM9AHNL8JnVf7zbpN5
+ z9jEs5uhhVOaoF64ggh2D4ZC9jOcS0VfMJaxH2EIZ9MkRjMoYPiBWB6IdRmMmNIY4pnOMGgxhAL5IAOU
+ gFgKiIWBmAeI2YCYEdlgEAcUQCB/ikMVS0LZokBaEIh5gZgLqpkZ3QBiXIlVDQDCO4gZa583FgAAAABJ
+ RU5ErkJggg==
+</value>
+ </data>
+ <data name="btnCheckRequired.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAG4SURBVDhPY2AYWmCNhDzDKtEzDCtFPUh3+Hx+AYZlIhvS
+ 3pX/Z1gucoZhGSmGrGJgY1gsPM/gmNPTqEfZ/+Nf5P9mWAQ0hCjwn4GRYb5wq8J2o3sBNxL/e1+N/sWz
+ XO4Sw0IRH1T9swU9GGYLngFiVP/NFsgUWql8w+1c+D/nMyF/+ZcpXmOYK5SMqnkKUNN0wTOJL4v+gmgG
+ EB8Epgn4cMyVuKy91ea32jrzf3wL5G8xTBeoxnT5JP4z0U9zf3lciPwf8SDzDwOQzzCRL5d5qtBppc0m
+ PxQ3Gf3nmyd3HyjWw1DPwIRpQC+fB0Mv7xm/m/E/lfYY/7c/H/ADxJfapPlZeofOf75Fck8YevjmATVz
+ 4A63NqAh7TxnjE45f5M4rPlf44zlf/FDGv/5V8q9YmjjXcfQD4xGgqCZy4OhifuM9AHNL8JnVf7zbpN5
+ z9jEs5uhhVOaoF64ggh2D4ZC9jOcS0VfMJaxH2EIZ9MkRjMoYPiBWB6IdRmMmNIY4pnOMGgxhAL5IAOU
+ gFgKiIWBmAeI2YCYEdlgEAcUQCB/ikMVS0LZokBaEIh5gZgLqpkZ3QBiXIlVDQDCO4gZa583FgAAAABJ
+ RU5ErkJggg==
+</value>
+ </data>
+</root>
\ No newline at end of file
Deleted: sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.Designer.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.Designer.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -1,263 +0,0 @@
-namespace Maestro.Editors.Migration
-{
- partial class ResourceMigrationDialog
- {
- /// <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 Windows Form 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.groupBox1 = new System.Windows.Forms.GroupBox();
- this.lstResources = new System.Windows.Forms.ListBox();
- this.toolStrip1 = new System.Windows.Forms.ToolStrip();
- this.btnAddResource = new System.Windows.Forms.ToolStripButton();
- this.btnAddFolder = new System.Windows.Forms.ToolStripButton();
- this.btnRemove = new System.Windows.Forms.ToolStripButton();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.btnBrowseTarget = new System.Windows.Forms.Button();
- this.txtTargetFolder = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.btnOK = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.chkOverwrite = new System.Windows.Forms.CheckBox();
- this.cmbAction = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.groupBox1.SuspendLayout();
- this.toolStrip1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.lstResources);
- this.groupBox1.Controls.Add(this.toolStrip1);
- this.groupBox1.Location = new System.Drawing.Point(13, 13);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(521, 154);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Source";
- //
- // lstResources
- //
- this.lstResources.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lstResources.FormattingEnabled = true;
- this.lstResources.Location = new System.Drawing.Point(3, 41);
- this.lstResources.Name = "lstResources";
- this.lstResources.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
- this.lstResources.Size = new System.Drawing.Size(515, 108);
- this.lstResources.TabIndex = 1;
- this.lstResources.SelectedIndexChanged += new System.EventHandler(this.lstResources_SelectedIndexChanged);
- //
- // toolStrip1
- //
- this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.btnAddResource,
- this.btnAddFolder,
- this.btnRemove});
- this.toolStrip1.Location = new System.Drawing.Point(3, 16);
- this.toolStrip1.Name = "toolStrip1";
- this.toolStrip1.Size = new System.Drawing.Size(515, 25);
- this.toolStrip1.TabIndex = 0;
- this.toolStrip1.Text = "toolStrip1";
- //
- // btnAddResource
- //
- this.btnAddResource.Image = global::Maestro.Editors.Properties.Resources.document__plus;
- this.btnAddResource.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnAddResource.Name = "btnAddResource";
- this.btnAddResource.Size = new System.Drawing.Size(100, 22);
- this.btnAddResource.Text = "Add Resource";
- this.btnAddResource.Click += new System.EventHandler(this.btnAddResource_Click);
- //
- // btnAddFolder
- //
- this.btnAddFolder.Image = global::Maestro.Editors.Properties.Resources.folder__plus;
- this.btnAddFolder.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnAddFolder.Name = "btnAddFolder";
- this.btnAddFolder.Size = new System.Drawing.Size(85, 22);
- this.btnAddFolder.Text = "Add Folder";
- this.btnAddFolder.Click += new System.EventHandler(this.btnAddFolder_Click);
- //
- // btnRemove
- //
- this.btnRemove.Enabled = false;
- this.btnRemove.Image = global::Maestro.Editors.Properties.Resources.cross_script;
- this.btnRemove.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnRemove.Name = "btnRemove";
- this.btnRemove.Size = new System.Drawing.Size(70, 22);
- this.btnRemove.Text = "Remove";
- this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.btnBrowseTarget);
- this.groupBox2.Controls.Add(this.txtTargetFolder);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Location = new System.Drawing.Point(13, 173);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(521, 61);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Target";
- //
- // btnBrowseTarget
- //
- this.btnBrowseTarget.Location = new System.Drawing.Point(478, 24);
- this.btnBrowseTarget.Name = "btnBrowseTarget";
- this.btnBrowseTarget.Size = new System.Drawing.Size(27, 23);
- this.btnBrowseTarget.TabIndex = 2;
- this.btnBrowseTarget.Text = "...";
- this.btnBrowseTarget.UseVisualStyleBackColor = true;
- this.btnBrowseTarget.Click += new System.EventHandler(this.btnBrowseTarget_Click);
- //
- // txtTargetFolder
- //
- this.txtTargetFolder.Location = new System.Drawing.Point(78, 26);
- this.txtTargetFolder.Name = "txtTargetFolder";
- this.txtTargetFolder.ReadOnly = true;
- this.txtTargetFolder.Size = new System.Drawing.Size(394, 20);
- this.txtTargetFolder.TabIndex = 1;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(26, 29);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(36, 13);
- this.label1.TabIndex = 0;
- this.label1.Text = "Folder";
- //
- // btnOK
- //
- this.btnOK.Enabled = false;
- this.btnOK.Location = new System.Drawing.Point(378, 352);
- this.btnOK.Name = "btnOK";
- this.btnOK.Size = new System.Drawing.Size(75, 23);
- this.btnOK.TabIndex = 2;
- this.btnOK.Text = "OK";
- this.btnOK.UseVisualStyleBackColor = true;
- this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(459, 352);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 23);
- this.btnCancel.TabIndex = 3;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.chkOverwrite);
- this.groupBox3.Controls.Add(this.cmbAction);
- this.groupBox3.Controls.Add(this.label2);
- this.groupBox3.Location = new System.Drawing.Point(13, 240);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(521, 106);
- this.groupBox3.TabIndex = 4;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Migration Options";
- //
- // chkOverwrite
- //
- this.chkOverwrite.AutoSize = true;
- this.chkOverwrite.Location = new System.Drawing.Point(29, 64);
- this.chkOverwrite.Name = "chkOverwrite";
- this.chkOverwrite.Size = new System.Drawing.Size(212, 17);
- this.chkOverwrite.TabIndex = 2;
- this.chkOverwrite.Text = "Overwrite Resources of the same name";
- this.chkOverwrite.UseVisualStyleBackColor = true;
- //
- // cmbAction
- //
- this.cmbAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbAction.FormattingEnabled = true;
- this.cmbAction.Location = new System.Drawing.Point(130, 26);
- this.cmbAction.Name = "cmbAction";
- this.cmbAction.Size = new System.Drawing.Size(121, 21);
- this.cmbAction.TabIndex = 1;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(26, 29);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(83, 13);
- this.label2.TabIndex = 0;
- this.label2.Text = "Migration Action";
- //
- // ResourceMigrationDialog
- //
- this.AcceptButton = this.btnOK;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(546, 387);
- this.ControlBox = false;
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOK);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "ResourceMigrationDialog";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Migrate Resources";
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.toolStrip1.ResumeLayout(false);
- this.toolStrip1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.Button btnOK;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.CheckBox chkOverwrite;
- private System.Windows.Forms.ComboBox cmbAction;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.ListBox lstResources;
- private System.Windows.Forms.ToolStrip toolStrip1;
- private System.Windows.Forms.ToolStripButton btnAddResource;
- private System.Windows.Forms.ToolStripButton btnAddFolder;
- private System.Windows.Forms.ToolStripButton btnRemove;
- private System.Windows.Forms.Button btnBrowseTarget;
- private System.Windows.Forms.TextBox txtTargetFolder;
- }
-}
\ No newline at end of file
Deleted: sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -1,175 +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.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using OSGeo.MapGuide.MaestroAPI;
-using Maestro.Editors.Generic;
-
-namespace Maestro.Editors.Migration
-{
- public partial class ResourceMigrationDialog : Form
- {
- private ResourceMigrationDialog()
- {
- InitializeComponent();
- cmbAction.DataSource = Enum.GetValues(typeof(MigrationAction));
- }
-
- private IServerConnection _source;
- private IServerConnection _target;
-
- public ResourceMigrationDialog(IServerConnection source, IServerConnection target)
- : this()
- {
- _source = source;
- _target = target;
- }
-
- private void lstResources_SelectedIndexChanged(object sender, EventArgs e)
- {
- EvaluateCommandState();
- }
-
- private void btnAddResource_Click(object sender, EventArgs e)
- {
- using (var picker = new ResourcePicker(_source.ResourceService, ResourcePickerMode.OpenResource))
- {
- if (picker.ShowDialog() == DialogResult.OK)
- {
- if (!lstResources.Items.Contains(picker.ResourceID))
- lstResources.Items.Add(picker.ResourceID);
-
- EvaluateCommandState();
- }
- }
- }
-
- private void btnAddFolder_Click(object sender, EventArgs e)
- {
- using (var picker = new ResourcePicker(_source.ResourceService, ResourcePickerMode.OpenFolder))
- {
- if (picker.ShowDialog() == DialogResult.OK)
- {
- var folderId = picker.ResourceID;
- var list = _target.ResourceService.GetRepositoryResources(folderId);
-
- foreach (var item in list.Children)
- {
- if (!item.IsFolder && !lstResources.Items.Contains(item.ResourceId))
- lstResources.Items.Add(item.ResourceId);
- }
- EvaluateCommandState();
- }
- }
- }
-
- private void btnRemove_Click(object sender, EventArgs e)
- {
- var items = lstResources.SelectedItems;
- if (items != null && items.Count > 0)
- {
- for (int i = 0; i < items.Count; i++)
- {
- lstResources.Items.Remove(items[i]);
- EvaluateCommandState();
- }
- }
- }
-
- private void btnOK_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.OK;
- }
-
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- }
-
- public string TargetFolder
- {
- get { return txtTargetFolder.Text; }
- set { txtTargetFolder.Text = value; }
- }
-
- public string[] SourceResourceIds
- {
- get
- {
- List<string> resIds = new List<string>();
- foreach (var item in lstResources.Items)
- {
- resIds.Add(item.ToString());
- }
- return resIds.ToArray();
- }
- set
- {
- lstResources.Items.Clear();
- foreach (var resId in value)
- {
- lstResources.Items.Add(resId);
- }
- EvaluateCommandState();
- }
- }
-
- public MigrationAction SelectedAction
- {
- get { return (MigrationAction)cmbAction.SelectedItem; }
- set { cmbAction.SelectedItem = value ; }
- }
-
- public bool OverwriteResources
- {
- get { return chkOverwrite.Checked; }
- set { chkOverwrite.Checked = value; }
- }
-
- private void btnBrowseTarget_Click(object sender, EventArgs e)
- {
- using (var picker = new ResourcePicker(_target.ResourceService, ResourcePickerMode.OpenFolder))
- {
- if (picker.ShowDialog() == DialogResult.OK)
- {
- txtTargetFolder.Text = picker.ResourceID;
- EvaluateCommandState();
- }
- }
- }
-
- private void EvaluateCommandState()
- {
- btnRemove.Enabled = (lstResources.SelectedItem != null) || (lstResources.SelectedItems != null && lstResources.SelectedItems.Count > 0);
- btnOK.Enabled = (lstResources.Items.Count > 0) && !string.IsNullOrEmpty(txtTargetFolder.Text);
- }
- }
-
- public enum MigrationAction
- {
- Copy,
- Move
- }
-}
Deleted: sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.resx 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/Maestro.Editors/Migration/ResourceMigrationDialog.resx 2010-10-26 07:58:48 UTC (rev 5327)
@@ -1,123 +0,0 @@
-<?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>
- <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/OSGeo.MapGuide.MaestroAPI/CrossConnection/ResourceMigrator.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/CrossConnection/ResourceMigrator.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/CrossConnection/ResourceMigrator.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -52,6 +52,9 @@
/// <returns></returns>
public int CopyResources(string[] resourceIds, string folderId, bool overwrite, LengthyOperationProgressCallBack callback)
{
+ Check.NotNull(resourceIds, "resourceIds");
+ Check.NotEmpty(folderId, "folderId");
+
var cb = callback;
if (cb == null)
{
@@ -108,6 +111,9 @@
/// <returns></returns>
public int MoveResources(string[] resourceIds, string folderId, bool overwrite, LengthyOperationProgressCallBack callback)
{
+ Check.NotNull(resourceIds, "resourceIds");
+ Check.NotEmpty(folderId, "folderId");
+
var cb = callback;
if (cb == null)
{
@@ -155,11 +161,158 @@
return moved;
}
+ /// <summary>
+ /// Migrates a specific resource (and its dependent resources) to the target connection
+ /// </summary>
+ /// <param name="resourceId">The id of the resource to migrate</param>
+ /// <param name="dependentResourceIds">The array of dependent resource ids</param>
+ /// <param name="overwrite">If true, all dependent resources that already exist in the target connection are overwritten, otherwise these are not copied over</param>
+ /// <param name="callback">A callback method to indicate progress</param>
+ /// <returns>An array of resource ids that were succesfully migrated</returns>
+ public string[] MigrateResource(string resourceId, string[] dependentResourceIds, bool overwrite, LengthyOperationProgressCallBack callback)
+ {
+ Check.NotEmpty(resourceId, "resourceId");
+ Check.NotNull(dependentResourceIds, "dependentResourceIds");
+
+ //TODO: Figure out a more elegant strategy of handling saving resources
+ //to older versions (downgrading?)
+
+ //TODO: This should not return a string array, it should return an array
+ //of migration results. This requires a new API (Capability?) to test whether a resource
+ //can be saved to this connection
+
+ List<string> migrated = new List<string>();
+
+ LengthyOperationProgressCallBack cb = callback;
+ if (cb == null)
+ {
+ cb = new LengthyOperationProgressCallBack((o, a) => { });
+ }
+
+ int total = dependentResourceIds.Length + 1;
+ int unit = 100 / total;
+ int progress = 0;
+
+ try
+ {
+ //Copy the specified resource
+ IResource res = _source.ResourceService.GetResource(resourceId);
+ _target.ResourceService.SaveResource(res);
+
+ //Copy its resource data
+ foreach (var data in res.EnumerateResourceData())
+ {
+ using (var stream = res.GetResourceData(data.Name))
+ {
+ stream.Position = 0L;
+ _target.ResourceService.SetResourceData(resourceId, data.Name, data.Type, stream);
+ }
+ }
+
+ migrated.Add(resourceId);
+ }
+ catch //This happens if we're saving a resource to an older version where this resource version does not exist
+ {
+ }
+
+ //If the first one failed, abort early. Don't bother with the rest
+ if (migrated.Count == 1)
+ {
+ progress += unit;
+ cb(this, new LengthyOperationProgressArgs(string.Format(Properties.Resources.CopiedResource, resourceId), progress));
+
+ //Now copy dependents
+ foreach (var resId in dependentResourceIds)
+ {
+ bool existsOnTarget = _target.ResourceService.ResourceExists(resId);
+ if ((existsOnTarget && overwrite) || !existsOnTarget)
+ {
+ try
+ {
+ //Copy the specified resource
+ IResource res = _source.ResourceService.GetResource(resId);
+ _target.ResourceService.SaveResource(res);
+
+ //Copy its resource data
+ foreach (var data in res.EnumerateResourceData())
+ {
+ using (var stream = res.GetResourceData(data.Name))
+ {
+ stream.Position = 0L;
+ _target.ResourceService.SetResourceData(resId, data.Name, data.Type, stream);
+ }
+ }
+
+ migrated.Add(resId);
+ }
+ catch //This happens if we're saving a resource to an older version where this resource version does not exist
+ {
+
+ }
+
+ progress += unit;
+ cb(this, new LengthyOperationProgressArgs(string.Format(Properties.Resources.CopiedResource, resId), progress));
+ }
+ }
+ }
+ return migrated.ToArray();
+ }
+
+ /// <summary>
+ /// Shortcut API to migrate a specific resource to the target connection. Dependent resources are automatically
+ /// migrated as well. This copies all dependent resources of the specified resource.
+ /// </summary>
+ /// <param name="resourceId">The id of the resource to migrate</param>
+ /// <param name="overwrite">If true, all dependent resources that already exist in the target connection are overwritten, otherwise these are not copied over</param>
+ /// <param name="callback">A callback method to indicate progress</param>
+ /// <returns>An array of resource ids that were succesfully migrated</returns>
+ public string[] MigrateResource(string resourceId, bool overwrite, LengthyOperationProgressCallBack callback)
+ {
+ Check.NotEmpty(resourceId, "resourceId");
+ Dictionary<string, string> resIds = new Dictionary<string, string>();
+ var refList = GetReverseReferences(resourceId);
+ BuildFullDependencyList(resIds, refList);
+
+ return MigrateResource(resourceId, new List<string>(resIds.Keys).ToArray(), overwrite, callback);
+ }
+
+ private List<string> GetReverseReferences(string id)
+ {
+ System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
+ using (var ms = _source.ResourceService.GetResourceXmlData(id))
+ {
+ doc.Load(ms);
+ }
+
+ List<KeyValuePair<System.Xml.XmlNode, string>> refs = Utility.GetResourceIdPointers(doc);
+ List<string> dependentIds = new List<string>();
+ foreach (KeyValuePair<System.Xml.XmlNode, string> s in refs)
+ if (!dependentIds.Contains(s.Value))
+ dependentIds.Add(s.Value);
+ return dependentIds;
+ }
+
+ private void BuildFullDependencyList(Dictionary<string, string> resIds, IEnumerable<string> resourceIds)
+ {
+ foreach (var id in resourceIds)
+ {
+ resIds[id] = id;
+ var refList = GetReverseReferences(id);
+ BuildFullDependencyList(resIds, refList);
+ }
+ }
+
+ /// <summary>
+ /// Gets the source connection
+ /// </summary>
public IServerConnection Source
{
get { return _source; }
}
+ /// <summary>
+ /// Gets the target connection
+ /// </summary>
public IServerConnection Target
{
get { return _target; }
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlAggregateSetReader.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlAggregateSetReader.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlAggregateSetReader.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -161,6 +161,8 @@
m_items[ordinal] = XmlConvert.ToInt64(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(short))
m_items[ordinal] = XmlConvert.ToInt16(valueNode.InnerText);
+ else if (parent.Columns[ordinal].Type == typeof(float))
+ m_items[ordinal] = XmlConvert.ToSingle(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(double))
m_items[ordinal] = XmlConvert.ToDouble(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(bool))
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlFeatureSetReader.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlFeatureSetReader.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlFeatureSetReader.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -162,6 +162,8 @@
m_items[ordinal] = XmlConvert.ToInt64(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(short))
m_items[ordinal] = XmlConvert.ToInt16(valueNode.InnerText);
+ else if (parent.Columns[ordinal].Type == typeof(float))
+ m_items[ordinal] = XmlConvert.ToSingle(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(double))
m_items[ordinal] = XmlConvert.ToDouble(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(bool))
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlSqlResultReader.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlSqlResultReader.cs 2010-10-25 10:48:00 UTC (rev 5326)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/XmlSqlResultReader.cs 2010-10-26 07:58:48 UTC (rev 5327)
@@ -161,6 +161,8 @@
m_items[ordinal] = XmlConvert.ToInt64(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(short))
m_items[ordinal] = XmlConvert.ToInt16(valueNode.InnerText);
+ else if (parent.Columns[ordinal].Type == typeof(float))
+ m_items[ordinal] = XmlConvert.ToSingle(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(double))
m_items[ordinal] = XmlConvert.ToDouble(valueNode.InnerText);
else if (parent.Columns[ordinal].Type == typeof(bool))
More information about the mapguide-commits
mailing list