[mapguide-commits] r6663 - in branches/maestro-4.0.x: Maestro.Base/Commands Maestro.Base/Events Maestro.Editors/Diagnostics

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu May 17 12:13:45 EDT 2012


Author: jng
Date: 2012-05-17 09:13:44 -0700 (Thu, 17 May 2012)
New Revision: 6663

Modified:
   branches/maestro-4.0.x/Maestro.Base/Commands/ServerMonitorCommand.cs
   branches/maestro-4.0.x/Maestro.Base/Events/EventWatcher.cs
   branches/maestro-4.0.x/Maestro.Editors/Diagnostics/ServerStatusMonitor.cs
Log:
#1958: Fix server status monitor. This was due to the actual initialization code commented out in the process of implementing multiple site support. This command will now be monitoring the active connection in a multiple connection session where the active session = the top-level parent connection of any selected node in the Site Explorer

Modified: branches/maestro-4.0.x/Maestro.Base/Commands/ServerMonitorCommand.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Base/Commands/ServerMonitorCommand.cs	2012-05-17 16:10:27 UTC (rev 6662)
+++ branches/maestro-4.0.x/Maestro.Base/Commands/ServerMonitorCommand.cs	2012-05-17 16:13:44 UTC (rev 6663)
@@ -34,6 +34,20 @@
         {
             try
             {
+                var wb = Workbench.Instance;
+                var exp = wb.ActiveSiteExplorer;
+                var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+                var conn = connMgr.GetConnection(exp.ConnectionName);
+
+                ISiteService siteSvc = null;
+                var svcTypes = conn.Capabilities.SupportedServices;
+                if (Array.IndexOf(svcTypes, (int)ServiceType.Site) >= 0)
+                {
+                    siteSvc = (ISiteService)conn.GetService((int)ServiceType.Site);
+                }
+
+                if (siteSvc != null)
+                    ServerStatusMonitor.Init(siteSvc);
                 ServerStatusMonitor.ShowWindow();
             }
             catch (Exception ex)

Modified: branches/maestro-4.0.x/Maestro.Base/Events/EventWatcher.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Base/Events/EventWatcher.cs	2012-05-17 16:10:27 UTC (rev 6662)
+++ branches/maestro-4.0.x/Maestro.Base/Events/EventWatcher.cs	2012-05-17 16:13:44 UTC (rev 6663)
@@ -94,12 +94,6 @@
             var svc = ServiceRegistry.GetService<ServerConnectionManager>();
             LoggingService.Info("There are now " + svc.GetConnectionNames().Count + " active connections"); //LOCALIZEME
             //Debug.Assert(wb.ActiveSiteExplorer.ConnectionName == name);
-
-            /*
-            //TODO: Review this API design when we do decide to support multiple
-            //site connections
-            ServerStatusMonitor.Init(null);
-             */
         }
 
         static void OnConnectionAdded(object sender, string name)
@@ -118,18 +112,6 @@
             var conn = svc.GetConnection(name);
 
             LoggingService.Info("There are now " + svc.GetConnectionNames().Count + " active connections"); //LOCALIZEME
-
-            /*
-            ISiteService siteSvc = null;
-            var svcTypes = conn.Capabilities.SupportedServices;
-            if (Array.IndexOf(svcTypes, (int)ServiceType.Site) >= 0)
-            {
-                siteSvc = (ISiteService)conn.GetService((int)ServiceType.Site);
-            }
-            //TODO: Review this API design when we do decide to support multiple
-            //site connections
-            ServerStatusMonitor.Init(siteSvc);
-             */
         }
     }
 }

Modified: branches/maestro-4.0.x/Maestro.Editors/Diagnostics/ServerStatusMonitor.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Diagnostics/ServerStatusMonitor.cs	2012-05-17 16:10:27 UTC (rev 6662)
+++ branches/maestro-4.0.x/Maestro.Editors/Diagnostics/ServerStatusMonitor.cs	2012-05-17 16:13:44 UTC (rev 6663)
@@ -74,8 +74,19 @@
         /// </summary>
         public static void ShowWindow()
         {
+            ShowWindow(true);
+        }
+
+        private static bool _cleanupOnClose = true;
+
+        /// <summary>
+        /// Shows the window.
+        /// </summary>
+        public static void ShowWindow(bool cleanupOnClose)
+        {
             if (_smConn != null)
             {
+                _cleanupOnClose = cleanupOnClose;
                 _smMonitor.DoPoll();
                 _smMonitor.StartTimer();
                 _smMonitor.Show();
@@ -93,6 +104,8 @@
         {
             _smMonitor.StopTimer();
             _smMonitor.Hide();
+            if (_cleanupOnClose)
+                Init(null);
         }
 
         private void pollTimer_Tick(object sender, EventArgs e)



More information about the mapguide-commits mailing list