[mapguide-commits] r4906 - in sandbox/maestro-2.5: Maestro.Base
Maestro.Base/Commands/Test Maestro.Editors/Common
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 18 04:59:25 EDT 2010
Author: jng
Date: 2010-05-18 04:59:24 -0400 (Tue, 18 May 2010)
New Revision: 4906
Added:
sandbox/maestro-2.5/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs
Modified:
sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin
sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj
sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.Designer.cs
sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.cs
Log:
Implement FDO Provider selection dialog
Added: sandbox/maestro-2.5/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Commands/Test/SelectFdoProviderCommand.cs 2010-05-18 08:59:24 UTC (rev 4906)
@@ -0,0 +1,49 @@
+#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.Editors.Common;
+
+namespace Maestro.Base.Commands.Test
+{
+ public class SelectFdoProviderCommand : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ var exp = wb.ActiveSiteExplorer;
+ 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)
+ {
+ MessageService.ShowMessage(picker.ProviderName);
+ }
+ else
+ {
+ MessageService.ShowMessage("Cancelled");
+ }
+ }
+ }
+}
Modified: sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin 2010-05-18 08:48:06 UTC (rev 4905)
+++ sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin 2010-05-18 08:59:24 UTC (rev 4906)
@@ -65,6 +65,9 @@
<MenuItem id="Menu_Test_OpenSymbolBrowser"
label="Open Symbol Browser"
class="Maestro.Base.Commands.Test.OpenSymbolBrowserCommand" />
+ <MenuItem id="Menu_Test_SelectFdoProvider"
+ label="Select FDO Provider"
+ class="Maestro.Base.Commands.Test.SelectFdoProviderCommand" />
</MenuItem>
<!-- -->
<MenuItem id="Menu_Tools"
Modified: sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj 2010-05-18 08:48:06 UTC (rev 4905)
+++ sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj 2010-05-18 08:59:24 UTC (rev 4906)
@@ -60,6 +60,7 @@
<Compile Include="Commands\Test\OpenCoordinateSystemPickerCommand.cs" />
<Compile Include="Commands\Test\OpenResourceCommand.cs" />
<Compile Include="Commands\Test\OpenSymbolBrowserCommand.cs" />
+ <Compile Include="Commands\Test\SelectFdoProviderCommand.cs" />
<Compile Include="Commands\Toggle\ToggleMessagesCommand.cs" />
<Compile Include="Commands\ValidateResourceCommand.cs" />
<Compile Include="Commands\XmlEditCommand.cs" />
Modified: sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.Designer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.Designer.cs 2010-05-18 08:48:06 UTC (rev 4905)
+++ sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.Designer.cs 2010-05-18 08:59:24 UTC (rev 4906)
@@ -45,6 +45,7 @@
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
//
@@ -58,6 +59,7 @@
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
//
@@ -78,6 +80,7 @@
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
//
Modified: sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.cs 2010-05-18 08:48:06 UTC (rev 4905)
+++ sandbox/maestro-2.5/Maestro.Editors/Common/FdoProviderPicker.cs 2010-05-18 08:59:24 UTC (rev 4906)
@@ -24,14 +24,51 @@
using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI.Services;
namespace Maestro.Editors.Common
{
public partial class FdoProviderPicker : Form
{
- public FdoProviderPicker()
+ 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;
+ }
}
}
More information about the mapguide-commits
mailing list