[mapguide-commits] r4877 - in sandbox/maestro-2.5/Maestro.Base:
Services UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri May 14 03:14:03 EDT 2010
Author: jng
Date: 2010-05-14 03:14:02 -0400 (Fri, 14 May 2010)
New Revision: 4877
Modified:
sandbox/maestro-2.5/Maestro.Base/Services/UrlLauncher.cs
sandbox/maestro-2.5/Maestro.Base/UI/ISiteExplorer.cs
sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs
Log:
- Use system web browser for UrlLauncher if embedded web browser cannot be used
- Add SelectedItems property to ISiteExplorer allowing other classes to interrogate.
Modified: sandbox/maestro-2.5/Maestro.Base/Services/UrlLauncher.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Services/UrlLauncher.cs 2010-05-14 06:55:46 UTC (rev 4876)
+++ sandbox/maestro-2.5/Maestro.Base/Services/UrlLauncher.cs 2010-05-14 07:14:02 UTC (rev 4877)
@@ -34,6 +34,11 @@
LoggingService.Info(Properties.Resources.Service_Init_Url_Launcher);
}
+ private bool CanUseEmbeddedWebBrowser
+ {
+ get { return Environment.OSVersion.Platform != PlatformID.MacOSX; } //There's no embedded wb for Mono on Mac (or so I'm told)
+ }
+
/// <summary>
/// Opens the specified url using the system default web browser
/// </summary>
@@ -44,17 +49,25 @@
}
/// <summary>
- /// Opens the specified url using the embedded web browser
+ /// Opens the specified url using the embedded web browser. If embedded browsers are not supported,
+ /// it will open it in the default system web browser.
/// </summary>
/// <param name="url">the url to open</param>
/// <param name="locked">If true, the navigation toolbar will be disabled</param>
public void OpenUrlEmbedded(string url, bool locked)
{
- var mgr = ServiceRegistry.GetService<ViewContentManager>();
- var browser = mgr.OpenContent<EmbeddedWebBrowser>(ViewRegion.Document);
-
- browser.IsLockedDown = locked;
- browser.NavigateToUrl(url);
+ if (CanUseEmbeddedWebBrowser)
+ {
+ var mgr = ServiceRegistry.GetService<ViewContentManager>();
+ var browser = mgr.OpenContent<EmbeddedWebBrowser>(ViewRegion.Document);
+
+ browser.IsLockedDown = locked;
+ browser.NavigateToUrl(url);
+ }
+ else
+ {
+ OpenUrl(url);
+ }
}
}
}
Modified: sandbox/maestro-2.5/Maestro.Base/UI/ISiteExplorer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/ISiteExplorer.cs 2010-05-14 06:55:46 UTC (rev 4876)
+++ sandbox/maestro-2.5/Maestro.Base/UI/ISiteExplorer.cs 2010-05-14 07:14:02 UTC (rev 4877)
@@ -37,5 +37,10 @@
/// </summary>
/// <param name="folderID"></param>
void Refresh(string folderID);
+
+ /// <summary>
+ /// Gets the items currently selected
+ /// </summary>
+ RepositoryItem[] SelectedItems { get; }
}
}
Modified: sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs 2010-05-14 06:55:46 UTC (rev 4876)
+++ sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs 2010-05-14 07:14:02 UTC (rev 4877)
@@ -109,13 +109,12 @@
{
if (e.Button == MouseButtons.Right)
{
- var nodes = trvResources.SelectedNodes;
- if (nodes != null && nodes.Count > 0)
+ var items = this.SelectedItems;
+ if (items.Length > 0)
{
- if (nodes.Count == 1) //Single select
+ if (items.Length == 1) //Single select
{
- var node = nodes[0];
- RepositoryItem item = (RepositoryItem)node.Tag;
+ RepositoryItem item = items[0];
if (item.IsFolder)
MenuService.ShowContextMenu(this, "/Maestro/Shell/SiteExplorer/SelectedFolder", trvResources, e.X, e.Y);
else
@@ -126,9 +125,8 @@
//All must be uniform type
int folderCount = 0;
- foreach (var node in nodes)
+ foreach (var item in items)
{
- var item = (RepositoryItem)node.Tag;
if (item.IsFolder)
folderCount++;
}
@@ -137,7 +135,7 @@
{
MenuService.ShowContextMenu(this, "/Maestro/Shell/SiteExplorer/SelectedDocuments", trvResources, e.X, e.Y);
}
- else if (folderCount == nodes.Count) //All selected folders
+ else if (folderCount == items.Length) //All selected folders
{
MenuService.ShowContextMenu(this, "/Maestro/Shell/SiteExplorer/SelectedFolders", trvResources, e.X, e.Y);
}
@@ -149,5 +147,22 @@
}
}
}
+
+
+ public RepositoryItem[] SelectedItems
+ {
+ get
+ {
+ List<RepositoryItem> items = new List<RepositoryItem>();
+ if (trvResources.SelectedNodes.Count > 0)
+ {
+ foreach (var node in trvResources.SelectedNodes)
+ {
+ items.Add((RepositoryItem)node.Tag);
+ }
+ }
+ return items.ToArray();
+ }
+ }
}
}
More information about the mapguide-commits
mailing list