[mapguide-commits] r5074 - in sandbox/maestro-3.0: Maestro.Base/Commands/Test Maestro.Editors Maestro.Editors/Common

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Aug 6 01:43:53 EDT 2010


Author: jng
Date: 2010-08-06 05:43:53 +0000 (Fri, 06 Aug 2010)
New Revision: 5074

Added:
   sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.resx
Removed:
   sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.resx
Modified:
   sandbox/maestro-3.0/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs
   sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
Log:
Replace the FDO provider selection dialog with a generic one that can be reused for other situations


Modified: sandbox/maestro-3.0/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs	2010-08-06 05:29:48 UTC (rev 5073)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs	2010-08-06 05:43:53 UTC (rev 5074)
@@ -35,10 +35,11 @@
             var mgr = ServiceRegistry.GetService<ServerConnectionManager>();
             var conn = mgr.GetConnection(exp.ConnectionName);
 
-            var picker = new FdoProviderPicker(conn.FeatureService);
-            if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            var providers = conn.FeatureService.FeatureProviders;
+            var provider = GenericItemSelectionDialog.SelectItem("Select FDO provider", "Select an FDO provider", providers, "DisplayName", "Name");
+            if (provider != null)
             {
-                MessageService.ShowMessage(picker.ProviderName);
+                MessageService.ShowMessage(provider.DisplayName);
             }
             else
             {

Deleted: sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.Designer.cs	2010-08-06 05:29:48 UTC (rev 5073)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.Designer.cs	2010-08-06 05:43:53 UTC (rev 5074)
@@ -1,110 +0,0 @@
-namespace Maestro.Editors.Common
-{
-    partial class FdoProviderPicker
-    {
-        /// <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.CancelBtn = new System.Windows.Forms.Button();
-            this.OKBtn = new System.Windows.Forms.Button();
-            this.label1 = new System.Windows.Forms.Label();
-            this.ProviderList = new System.Windows.Forms.ListBox();
-            this.SuspendLayout();
-            // 
-            // CancelBtn
-            // 
-            this.CancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
-            this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.CancelBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
-            this.CancelBtn.Location = new System.Drawing.Point(134, 228);
-            this.CancelBtn.Name = "CancelBtn";
-            this.CancelBtn.Size = new System.Drawing.Size(80, 32);
-            this.CancelBtn.TabIndex = 8;
-            this.CancelBtn.Text = "Cancel";
-            this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
-            // 
-            // OKBtn
-            // 
-            this.OKBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
-            this.OKBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.OKBtn.Enabled = false;
-            this.OKBtn.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.OKBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
-            this.OKBtn.Location = new System.Drawing.Point(30, 228);
-            this.OKBtn.Name = "OKBtn";
-            this.OKBtn.Size = new System.Drawing.Size(80, 32);
-            this.OKBtn.TabIndex = 7;
-            this.OKBtn.Text = "OK";
-            this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click);
-            // 
-            // label1
-            // 
-            this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
-            this.label1.Location = new System.Drawing.Point(12, 10);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(120, 16);
-            this.label1.TabIndex = 6;
-            this.label1.Text = "Providers on server:";
-            // 
-            // ProviderList
-            // 
-            this.ProviderList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                        | System.Windows.Forms.AnchorStyles.Left)
-                        | System.Windows.Forms.AnchorStyles.Right)));
-            this.ProviderList.Location = new System.Drawing.Point(12, 26);
-            this.ProviderList.Name = "ProviderList";
-            this.ProviderList.Size = new System.Drawing.Size(218, 186);
-            this.ProviderList.TabIndex = 5;
-            this.ProviderList.SelectedIndexChanged += new System.EventHandler(this.ProviderList_SelectedIndexChanged);
-            // 
-            // FdoProviderPicker
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(242, 272);
-            this.ControlBox = false;
-            this.Controls.Add(this.CancelBtn);
-            this.Controls.Add(this.OKBtn);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.ProviderList);
-            this.Name = "FdoProviderPicker";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
-            this.Text = "Select FDO Provider";
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private System.Windows.Forms.Button CancelBtn;
-        private System.Windows.Forms.Button OKBtn;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.ListBox ProviderList;
-
-    }
-}
\ No newline at end of file

Deleted: sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.cs	2010-08-06 05:29:48 UTC (rev 5073)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.cs	2010-08-06 05:43:53 UTC (rev 5074)
@@ -1,74 +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.Services;
-
-namespace Maestro.Editors.Common
-{
-    public partial class FdoProviderPicker : Form
-    {
-        private FdoProviderPicker()
-        {
-            InitializeComponent();
-        }
-
-        public FdoProviderPicker(IFeatureService featSvc)
-            : this()
-        {
-            var providers = featSvc.FeatureProviders;
-            
-            ProviderList.DisplayMember = "DisplayName";
-            ProviderList.ValueMember = "Name";
-
-            ProviderList.DataSource = providers;
-        }
-
-        public string ProviderName
-        {
-            get 
-            {
-                if (ProviderList.SelectedIndex >= 0)
-                    return ProviderList.SelectedValue.ToString();
-                return string.Empty;
-            }
-        }
-
-        private void ProviderList_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            OKBtn.Enabled = (ProviderList.SelectedIndex >= 0);
-        }
-
-        private void CancelBtn_Click(object sender, EventArgs e)
-        {
-            this.DialogResult = DialogResult.Cancel;
-        }
-
-        private void OKBtn_Click(object sender, EventArgs e)
-        {
-            this.DialogResult = DialogResult.OK;
-        }
-    }
-}

Deleted: sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.resx	2010-08-06 05:29:48 UTC (rev 5073)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/FdoProviderPicker.resx	2010-08-06 05:43:53 UTC (rev 5074)
@@ -1,120 +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>
-</root>
\ No newline at end of file

Added: sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.Designer.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.Designer.cs	2010-08-06 05:43:53 UTC (rev 5074)
@@ -0,0 +1,108 @@
+namespace Maestro.Editors.Common
+{
+    partial class GenericItemSelectionDialog
+    {
+        /// <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.lstItems = new System.Windows.Forms.ListBox();
+            this.lblPrompt = new System.Windows.Forms.Label();
+            this.btnOK = new System.Windows.Forms.Button();
+            this.btnCancel = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // lstItems
+            // 
+            this.lstItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                        | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.lstItems.Location = new System.Drawing.Point(13, 42);
+            this.lstItems.Name = "lstItems";
+            this.lstItems.Size = new System.Drawing.Size(259, 173);
+            this.lstItems.TabIndex = 0;
+            this.lstItems.SelectedIndexChanged += new System.EventHandler(this.lstItems_SelectedIndexChanged);
+            // 
+            // lblPrompt
+            // 
+            this.lblPrompt.AutoSize = true;
+            this.lblPrompt.Location = new System.Drawing.Point(12, 21);
+            this.lblPrompt.Name = "lblPrompt";
+            this.lblPrompt.Size = new System.Drawing.Size(74, 13);
+            this.lblPrompt.TabIndex = 1;
+            this.lblPrompt.Text = "Select an item";
+            // 
+            // btnOK
+            // 
+            this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnOK.Enabled = false;
+            this.btnOK.Location = new System.Drawing.Point(116, 227);
+            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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.btnCancel.Location = new System.Drawing.Point(197, 227);
+            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);
+            // 
+            // ItemSelectionDialog
+            // 
+            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(284, 262);
+            this.ControlBox = false;
+            this.Controls.Add(this.btnCancel);
+            this.Controls.Add(this.btnOK);
+            this.Controls.Add(this.lblPrompt);
+            this.Controls.Add(this.lstItems);
+            this.Name = "ItemSelectionDialog";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "ItemSelectionDialog";
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ListBox lstItems;
+        private System.Windows.Forms.Label lblPrompt;
+        private System.Windows.Forms.Button btnOK;
+        private System.Windows.Forms.Button btnCancel;
+    }
+}
\ No newline at end of file

Added: sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/GenericItemSelectionDialog.cs	2010-08-06 05:43:53 UTC (rev 5074)
@@ -0,0 +1,106 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.Editors.Common
+{
+    /// <summary>
+    /// A generic dialog that allows selection of an object from a list of objects
+    /// </summary>
+    public partial class GenericItemSelectionDialog : Form
+    {
+        private GenericItemSelectionDialog()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// Displays a dialog to select an item from an array of items
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="title"></param>
+        /// <param name="prompt"></param>
+        /// <param name="items"></param>
+        /// <param name="displayMember"></param>
+        /// <param name="valueMember"></param>
+        /// <returns></returns>
+        public static T SelectItem<T>(string title, string prompt, T[] items, string displayMember, string valueMember) where T : class
+        {
+            var dlg = new GenericItemSelectionDialog();
+            dlg.Text = title;
+            dlg.lblPrompt.Text = prompt;
+
+            dlg.lstItems.DataSource = items;
+            if (!string.IsNullOrEmpty(displayMember))
+                dlg.lstItems.DisplayMember = displayMember;
+            if (!string.IsNullOrEmpty(valueMember))
+                dlg.lstItems.ValueMember = valueMember;
+
+            if (dlg.ShowDialog() == DialogResult.OK)
+            {
+                return (T)dlg.lstItems.SelectedItem;
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// Displays a dialog to select a string from an array of strings
+        /// </summary>
+        /// <param name="title"></param>
+        /// <param name="prompt"></param>
+        /// <param name="items"></param>
+        /// <returns></returns>
+        public static string SelectItem(string title, string prompt, string[] items)
+        {
+            var dlg = new GenericItemSelectionDialog();
+            dlg.Text = title;
+            dlg.lblPrompt.Text = prompt;
+
+            dlg.lstItems.DataSource = items;
+
+            if (dlg.ShowDialog() == DialogResult.OK)
+            {
+                return dlg.lstItems.SelectedItem.ToString();
+            }
+            return null;
+        }
+
+        private void lstItems_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            btnOK.Enabled = (lstItems.SelectedItem != null);
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+        }
+
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.OK;
+        }
+    }
+}

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

Modified: sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj	2010-08-06 05:29:48 UTC (rev 5073)
+++ sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj	2010-08-06 05:43:53 UTC (rev 5074)
@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
+    <ProductVersion>9.0.30729</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -70,12 +70,6 @@
     <Compile Include="Common\EditorBindableCollapsiblePanel.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Include="Common\FdoProviderPicker.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="Common\FdoProviderPicker.Designer.cs">
-      <DependentUpon>FdoProviderPicker.cs</DependentUpon>
-    </Compile>
     <Compile Include="Common\ExpressionEditor.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -85,6 +79,12 @@
     <Compile Include="Common\ImageStylePicker.cs">
       <SubType>Component</SubType>
     </Compile>
+    <Compile Include="Common\GenericItemSelectionDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Common\GenericItemSelectionDialog.Designer.cs">
+      <DependentUpon>GenericItemSelectionDialog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Common\ResourceDataCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -527,10 +527,6 @@
       <DependentUpon>DataFilesCtrl.cs</DependentUpon>
       <SubType>Designer</SubType>
     </EmbeddedResource>
-    <EmbeddedResource Include="Common\FdoProviderPicker.resx">
-      <DependentUpon>FdoProviderPicker.cs</DependentUpon>
-      <SubType>Designer</SubType>
-    </EmbeddedResource>
     <EmbeddedResource Include="Common\ExpressionEditor.resx">
       <DependentUpon>ExpressionEditor.cs</DependentUpon>
       <SubType>Designer</SubType>
@@ -538,6 +534,9 @@
     <EmbeddedResource Include="Common\ImageStylePicker.resx">
       <DependentUpon>ImageStylePicker.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Common\GenericItemSelectionDialog.resx">
+      <DependentUpon>GenericItemSelectionDialog.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Common\ResourceDataCtrl.resx">
       <DependentUpon>ResourceDataCtrl.cs</DependentUpon>
       <SubType>Designer</SubType>



More information about the mapguide-commits mailing list