[mapguide-commits] r5469 - in sandbox/maestro-3.0/Maestro.Base: .
Commands/SiteExplorer Properties Resources UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Dec 10 08:21:39 EST 2010
Author: jng
Date: 2010-12-10 05:21:38 -0800 (Fri, 10 Dec 2010)
New Revision: 5469
Added:
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
sandbox/maestro-3.0/Maestro.Base/Resources/document--arrow.png
sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.Designer.cs
sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.cs
sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.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
Log:
#606: Implement re-pointer function. This only applies to Layer Definitions and Map Definitions
Added: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs 2010-12-10 13:21:38 UTC (rev 5469)
@@ -0,0 +1,201 @@
+#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 OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Base.UI;
+using System.Diagnostics;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.ObjectModels.WebLayout;
+using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+ internal class RepointCommand : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ var exp = wb.ActiveSiteExplorer;
+ var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+ var conn = connMgr.GetConnection(exp.ConnectionName);
+ if (exp.SelectedItems.Length == 1)
+ {
+ var selected = exp.SelectedItems[0];
+ var resId = new ResourceIdentifier(selected.ResourceId);
+ if (resId.ResourceType == OSGeo.MapGuide.MaestroAPI.ResourceTypes.LayerDefinition)
+ {
+ DoRepointLayer(wb, conn, resId);
+ }
+ else if (resId.ResourceType == OSGeo.MapGuide.MaestroAPI.ResourceTypes.MapDefinition)
+ {
+ DoRepointMap(wb, conn, resId);
+ }
+ else
+ {
+ MessageService.ShowMessage(Properties.Resources.ResourceNotRepointable);
+ }
+ }
+ }
+
+ private void DoRepointMap(Workbench wb, OSGeo.MapGuide.MaestroAPI.IServerConnection conn, ResourceIdentifier resId)
+ {
+ var diag = new RepointerDialog(resId, conn.ResourceService);
+ if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ string srcMap = diag.Source;
+ string dstMap = diag.Target;
+
+ var deps = diag.Dependents;
+
+ ProgressDialog.DoBackgroundWork worker = (wk, e, args) =>
+ {
+ int updated = 0;
+ int total = deps.Count;
+ wk.ReportProgress(0, Properties.Resources.ProgressUpdatingReferences);
+ foreach (var dep in deps)
+ {
+ //Only web and flexible layouts depend on maps
+ var rt = ResourceIdentifier.GetResourceType(dep);
+ Debug.Assert(rt == ResourceTypes.WebLayout || rt == ResourceTypes.ApplicationDefinition);
+
+ bool changed = false;
+
+ IResource res = null;
+ if (rt == ResourceTypes.WebLayout)
+ {
+ IWebLayout wl = (IWebLayout)conn.ResourceService.GetResource(dep);
+ if (wl.Map.ResourceId.Equals(srcMap))
+ {
+ wl.Map.ResourceId = dstMap;
+ changed = true;
+ res = wl;
+ }
+ }
+ else //Flexible layout
+ {
+ IApplicationDefinition appDef = (IApplicationDefinition)conn.ResourceService.GetResource(dep);
+ foreach (var mg in appDef.MapSet.MapGroups)
+ {
+ foreach (var map in mg.Map)
+ {
+ if (map.Type.Equals("MapGuide"))
+ {
+ string mdfId = map.GetMapDefinition();
+ if (mdfId.Equals(srcMap))
+ {
+ map.SetMapDefinition(dstMap);
+ changed = true;
+ res = appDef;
+ }
+ }
+ }
+ }
+ }
+
+ //If it wasn't changed why did the resource service
+ //list this map as a dependent resource?
+ if (changed)
+ {
+ Debug.Assert(res != null);
+ conn.ResourceService.SaveResource(res);
+ updated++;
+
+ wk.ReportProgress((updated / total) * 100);
+ }
+ }
+ return updated;
+ };
+ var prd = new ProgressDialog();
+ int result = (int)prd.RunOperationAsync(wb, worker);
+ MessageService.ShowMessage(string.Format(Properties.Resources.ResourcesRepointed, result, dstMap));
+ }
+ }
+
+ private static void DoRepointLayer(Workbench wb, OSGeo.MapGuide.MaestroAPI.IServerConnection conn, ResourceIdentifier resId)
+ {
+ var diag = new RepointerDialog(resId, conn.ResourceService);
+ if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ string srcLayer = diag.Source;
+ string targetLayer = diag.Target;
+
+ var deps = diag.Dependents;
+
+ ProgressDialog.DoBackgroundWork worker = (wk, e, args) =>
+ {
+ int updated = 0;
+ int total = deps.Count;
+ wk.ReportProgress(0, Properties.Resources.ProgressUpdatingReferences);
+ foreach (var dep in deps)
+ {
+ //Only maps depend on layers
+ Debug.Assert(ResourceIdentifier.GetResourceType(dep) == OSGeo.MapGuide.MaestroAPI.ResourceTypes.MapDefinition);
+
+ IMapDefinition mdf = (IMapDefinition)conn.ResourceService.GetResource(dep);
+ bool changed = false;
+ //Find all references to source and replace with target
+ foreach (var layer in mdf.MapLayer)
+ {
+ if (layer.ResourceId.Equals(srcLayer))
+ {
+ layer.ResourceId = targetLayer;
+ changed = true;
+ }
+ }
+ if (mdf.BaseMap != null)
+ {
+ foreach (var group in mdf.BaseMap.BaseMapLayerGroup)
+ {
+ foreach (var layer in group.BaseMapLayer)
+ {
+ if (layer.ResourceId.Equals(srcLayer))
+ {
+ layer.ResourceId = targetLayer;
+ changed = true;
+ }
+ }
+ }
+ }
+
+ //If it wasn't changed why did the resource service
+ //list this map as a dependent resource?
+ if (changed)
+ {
+ conn.ResourceService.SaveResource(mdf);
+ updated++;
+
+ wk.ReportProgress((updated / total) * 100);
+ }
+ }
+ return updated;
+ };
+ var prd = new ProgressDialog();
+ int result = (int)prd.RunOperationAsync(wb, worker);
+ MessageService.ShowMessage(string.Format(Properties.Resources.ResourcesRepointed, result, targetLayer));
+ }
+ }
+ }
+}
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-12-10 12:17:38 UTC (rev 5468)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-12-10 13:21:38 UTC (rev 5469)
@@ -496,6 +496,10 @@
label="${res:SiteExplorer_CopyMoveToServer}"
class="Maestro.Base.Commands.SiteExplorer.CopyMoveToAnotherServerCommand" />
<MenuItem type="Separator" />
+ <MenuItem id="Repoint"
+ icon="document__arrow"
+ label="${res:SiteExplorer_Repoint}"
+ class="Maestro.Base.Commands.SiteExplorer.RepointCommand" />
<MenuItem id="Validate"
icon="tick"
label="${res:SiteExplorer_ValidateResources}"
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-12-10 12:17:38 UTC (rev 5468)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-12-10 13:21:38 UTC (rev 5469)
@@ -109,6 +109,7 @@
<Compile Include="Commands\SiteExplorer\OpenWithXmlEditorCommand.cs" />
<Compile Include="Commands\SiteExplorer\RefreshCommand.cs" />
<Compile Include="Commands\SiteExplorer\RenameCommand.cs" />
+ <Compile Include="Commands\SiteExplorer\RepointCommand.cs" />
<Compile Include="Commands\SiteExplorer\ResourcePropertiesCommand.cs" />
<Compile Include="Commands\SiteExplorer\ValidateCommand.cs" />
<Compile Include="Commands\StartupCommand.cs" />
@@ -295,6 +296,12 @@
<Compile Include="UI\RenameItemDialog.Designer.cs">
<DependentUpon>RenameItemDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="UI\RepointerDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\RepointerDialog.Designer.cs">
+ <DependentUpon>RepointerDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="UI\RepositoryTreeModel.cs" />
<Compile Include="UI\ResourceIconCache.cs" />
<Compile Include="UI\ResourcePropertiesDialog.cs">
@@ -345,6 +352,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Maestro.Base.addin" />
+ <None Include="Resources\document--arrow.png" />
<None Include="Resources\disks.png" />
<None Include="Resources\box--plus.png" />
<None Include="Resources\box--arrow.png" />
@@ -467,6 +475,9 @@
<EmbeddedResource Include="UI\RenameItemDialog.resx">
<DependentUpon>RenameItemDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="UI\RepointerDialog.resx">
+ <DependentUpon>RepointerDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="UI\ResourcePropertiesDialog.resx">
<DependentUpon>ResourcePropertiesDialog.cs</DependentUpon>
<SubType>Designer</SubType>
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-12-10 12:17:38 UTC (rev 5468)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-12-10 13:21:38 UTC (rev 5469)
@@ -469,6 +469,13 @@
}
}
+ internal static System.Drawing.Bitmap document__arrow {
+ get {
+ object obj = ResourceManager.GetObject("document__arrow", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap document__plus {
get {
object obj = ResourceManager.GetObject("document__plus", resourceCulture);
@@ -1116,6 +1123,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Updating References.
+ /// </summary>
+ internal static string ProgressUpdatingReferences {
+ get {
+ return ResourceManager.GetString("ProgressUpdatingReferences", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Rename to.
/// </summary>
internal static string RenameTo {
@@ -1150,6 +1166,24 @@
}
/// <summary>
+ /// Looks up a localized string similar to This selected resource is not re-pointable.
+ /// </summary>
+ internal static string ResourceNotRepointable {
+ get {
+ return ResourceManager.GetString("ResourceNotRepointable", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} resources re-pointed to {1}.
+ /// </summary>
+ internal static string ResourcesRepointed {
+ get {
+ return ResourceManager.GetString("ResourcesRepointed", 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}..
@@ -1429,6 +1463,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Repoint this resource.
+ /// </summary>
+ internal static string SiteExplorer_Repoint {
+ get {
+ return ResourceManager.GetString("SiteExplorer_Repoint", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Package folder.
/// </summary>
internal static string SiteExplorer_SelectedFolder_CreatePackage {
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-12-10 12:17:38 UTC (rev 5468)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-12-10 13:21:38 UTC (rev 5469)
@@ -808,4 +808,19 @@
<data name="ConfirmLoadPackage" xml:space="preserve">
<value>Are you sure you want to load this package file?</value>
</data>
+ <data name="ProgressUpdatingReferences" xml:space="preserve">
+ <value>Updating References</value>
+ </data>
+ <data name="ResourcesRepointed" xml:space="preserve">
+ <value>{0} resources re-pointed to {1}</value>
+ </data>
+ <data name="document__arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\document--arrow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="ResourceNotRepointable" xml:space="preserve">
+ <value>This selected resource is not re-pointable</value>
+ </data>
+ <data name="SiteExplorer_Repoint" xml:space="preserve">
+ <value>Repoint this resource</value>
+ </data>
</root>
\ No newline at end of file
Added: sandbox/maestro-3.0/Maestro.Base/Resources/document--arrow.png
===================================================================
(Binary files differ)
Property changes on: sandbox/maestro-3.0/Maestro.Base/Resources/document--arrow.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.Designer.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.Designer.cs 2010-12-10 13:21:38 UTC (rev 5469)
@@ -0,0 +1,150 @@
+namespace Maestro.Base.UI
+{
+ partial class RepointerDialog
+ {
+ /// <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(RepointerDialog));
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.txtSource = new System.Windows.Forms.TextBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.txtTarget = new System.Windows.Forms.TextBox();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.lstAffectedResources = new System.Windows.Forms.ListBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.txtSource);
+ resources.ApplyResources(this.groupBox1, "groupBox1");
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.TabStop = false;
+ //
+ // txtSource
+ //
+ resources.ApplyResources(this.txtSource, "txtSource");
+ this.txtSource.Name = "txtSource";
+ this.txtSource.ReadOnly = true;
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.btnBrowse);
+ this.groupBox2.Controls.Add(this.txtTarget);
+ resources.ApplyResources(this.groupBox2, "groupBox2");
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.TabStop = false;
+ //
+ // btnBrowse
+ //
+ resources.ApplyResources(this.btnBrowse, "btnBrowse");
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // txtTarget
+ //
+ resources.ApplyResources(this.txtTarget, "txtTarget");
+ this.txtTarget.Name = "txtTarget";
+ this.txtTarget.ReadOnly = true;
+ //
+ // groupBox3
+ //
+ resources.ApplyResources(this.groupBox3, "groupBox3");
+ this.groupBox3.Controls.Add(this.lstAffectedResources);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.TabStop = false;
+ //
+ // lstAffectedResources
+ //
+ resources.ApplyResources(this.lstAffectedResources, "lstAffectedResources");
+ this.lstAffectedResources.FormattingEnabled = true;
+ this.lstAffectedResources.Name = "lstAffectedResources";
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // btnOK
+ //
+ resources.ApplyResources(this.btnOK, "btnOK");
+ this.btnOK.Name = "btnOK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ resources.ApplyResources(this.btnCancel, "btnCancel");
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // RepointerDialog
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.CancelButton = this.btnCancel;
+ resources.ApplyResources(this, "$this");
+ this.ControlBox = false;
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "RepointerDialog";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.TextBox txtSource;
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.TextBox txtTarget;
+ private System.Windows.Forms.ListBox lstAffectedResources;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ }
+}
\ No newline at end of file
Added: sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.cs 2010-12-10 13:21:38 UTC (rev 5469)
@@ -0,0 +1,89 @@
+#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 OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Editors.Generic;
+using OSGeo.MapGuide.MaestroAPI.Services;
+
+namespace Maestro.Base.UI
+{
+ public partial class RepointerDialog : Form
+ {
+ private RepointerDialog()
+ {
+ InitializeComponent();
+ }
+
+ private IResourceService _resSvc;
+
+ public RepointerDialog(ResourceIdentifier resId, IResourceService resSvc)
+ : this()
+ {
+ _resSvc = resSvc;
+ txtSource.Text = resId.ToString();
+ this.ResourceType = resId.ResourceType;
+
+ var dependents = resSvc.EnumerateResourceReferences(resId.ToString());
+
+ lstAffectedResources.DataSource = dependents.ResourceId;
+ }
+
+ public ICollection<string> Dependents { get { return (ICollection<string>)lstAffectedResources.DataSource; } }
+
+ public string Source { get { return txtSource.Text; } }
+
+ public string Target { get { return txtTarget.Text; } }
+
+ public ResourceTypes ResourceType
+ {
+ get;
+ private set;
+ }
+
+ 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(_resSvc, this.ResourceType, ResourcePickerMode.OpenResource))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ txtTarget.Text = picker.ResourceID;
+ btnOK.Enabled = !string.IsNullOrEmpty(txtSource.Text) && !string.IsNullOrEmpty(txtTarget.Text);
+ }
+ }
+ }
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.resx (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/UI/RepointerDialog.resx 2010-12-10 13:21:38 UTC (rev 5469)
@@ -0,0 +1,390 @@
+<?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>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="txtSource.Location" type="System.Drawing.Point, System.Drawing">
+ <value>15, 28</value>
+ </data>
+ <data name="txtSource.Size" type="System.Drawing.Size, System.Drawing">
+ <value>276, 20</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="txtSource.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name=">>txtSource.Name" xml:space="preserve">
+ <value>txtSource</value>
+ </data>
+ <data name=">>txtSource.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtSource.Parent" xml:space="preserve">
+ <value>groupBox1</value>
+ </data>
+ <data name=">>txtSource.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 13</value>
+ </data>
+ <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>342, 62</value>
+ </data>
+ <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name="groupBox1.Text" xml:space="preserve">
+ <value>Source</value>
+ </data>
+ <data name=">>groupBox1.Name" xml:space="preserve">
+ <value>groupBox1</value>
+ </data>
+ <data name=">>groupBox1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>groupBox1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>groupBox1.ZOrder" xml:space="preserve">
+ <value>5</value>
+ </data>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="btnBrowse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="btnBrowse.Location" type="System.Drawing.Point, System.Drawing">
+ <value>296, 17</value>
+ </data>
+ <data name="btnBrowse.Size" type="System.Drawing.Size, System.Drawing">
+ <value>29, 23</value>
+ </data>
+ <data name="btnBrowse.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="btnBrowse.Text" xml:space="preserve">
+ <value>...</value>
+ </data>
+ <data name=">>btnBrowse.Name" xml:space="preserve">
+ <value>btnBrowse</value>
+ </data>
+ <data name=">>btnBrowse.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnBrowse.Parent" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>btnBrowse.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="txtTarget.Location" type="System.Drawing.Point, System.Drawing">
+ <value>14, 19</value>
+ </data>
+ <data name="txtTarget.Size" type="System.Drawing.Size, System.Drawing">
+ <value>276, 20</value>
+ </data>
+ <data name="txtTarget.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name=">>txtTarget.Name" xml:space="preserve">
+ <value>txtTarget</value>
+ </data>
+ <data name=">>txtTarget.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtTarget.Parent" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>txtTarget.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
+ <value>14, 81</value>
+ </data>
+ <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
+ <value>342, 55</value>
+ </data>
+ <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name="groupBox2.Text" xml:space="preserve">
+ <value>Target</value>
+ </data>
+ <data name=">>groupBox2.Name" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>groupBox2.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>groupBox2.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>groupBox2.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
+ <data name="groupBox3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Bottom, Left, Right</value>
+ </data>
+ <data name="lstAffectedResources.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Bottom, Left, Right</value>
+ </data>
+ <data name="lstAffectedResources.HorizontalScrollbar" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="lstAffectedResources.Location" type="System.Drawing.Point, System.Drawing">
+ <value>17, 26</value>
+ </data>
+ <data name="lstAffectedResources.Size" type="System.Drawing.Size, System.Drawing">
+ <value>179, 147</value>
+ </data>
+ <data name="lstAffectedResources.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name=">>lstAffectedResources.Name" xml:space="preserve">
+ <value>lstAffectedResources</value>
+ </data>
+ <data name=">>lstAffectedResources.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ListBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lstAffectedResources.Parent" xml:space="preserve">
+ <value>groupBox3</value>
+ </data>
+ <data name=">>lstAffectedResources.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing">
+ <value>362, 13</value>
+ </data>
+ <data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing">
+ <value>217, 193</value>
+ </data>
+ <data name="groupBox3.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="groupBox3.Text" xml:space="preserve">
+ <value>Resources Referencing Source</value>
+ </data>
+ <data name=">>groupBox3.Name" xml:space="preserve">
+ <value>groupBox3</value>
+ </data>
+ <data name=">>groupBox3.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>groupBox3.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>groupBox3.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>28, 156</value>
+ </data>
+ <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>311, 50</value>
+ </data>
+ <data name="label1.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name="label1.Text" xml:space="preserve">
+ <value>All resources currently pointing to the specified source will be pointed to the target instead</value>
+ </data>
+ <data name=">>label1.Name" xml:space="preserve">
+ <value>label1</value>
+ </data>
+ <data name=">>label1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label1.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="btnOK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="btnOK.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
+ <value>414, 220</value>
+ </data>
+ <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnOK.TabIndex" type="System.Int32, mscorlib">
+ <value>4</value>
+ </data>
+ <data name="btnOK.Text" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name=">>btnOK.Name" xml:space="preserve">
+ <value>btnOK</value>
+ </data>
+ <data name=">>btnOK.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnOK.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnOK.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
+ <value>495, 220</value>
+ </data>
+ <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
+ <value>5</value>
+ </data>
+ <data name="btnCancel.Text" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name=">>btnCancel.Name" xml:space="preserve">
+ <value>btnCancel</value>
+ </data>
+ <data name=">>btnCancel.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnCancel.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnCancel.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>594, 255</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Re-Point</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>RepointerDialog</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list