}//UpdateThisControl(); // // // // ***************************************************** // **** Create ServiceListEntry() **** // ***************************************************** /// <summary> /// Called each time new service is added to application. Here, it is examined /// and added to our list. /// </summary> /// <param name="serviceName"></param> /// <param name="entry"></param> /// <returns></returns> private bool TryCreateServiceListEntry(string serviceName, out ServiceListEntry entry) { IService iService; if (m_AppServices.TryGetService(serviceName, out iService)) { // Discover a frontend server to which we can send requests. if (m_FrontEndServer == null && iService is FrontEndServer) { m_FrontEndServer = (FrontEndServer)iService; } // Create a entry element for this service. entry = new ServiceListEntry(); entry.ServiceName = serviceName; entry.ServiceClassName = iService.GetType().Name; entry.Service = iService; if (iService is ForeignService) { ForeignService foreignService = (ForeignService)iService; entry.IsForeign = true; string[] s = foreignService.ClassName.Split('.'); entry.ServiceClassName = s[s.Length - 1]; } return(true); } else { entry = null; return(false); } }// TryCreateServiceListEntry()
}// TryCreateServiceListEntry() // // // // ********************************************* // **** UpdateServiceSelection() **** // ********************************************* private void UpdateServiceSelection() { int index = listBoxServices.SelectedIndex; if (index >= 0 && index < listBoxServices.Items.Count) { ServiceListEntry entry = (ServiceListEntry)listBoxServices.Items[index]; textServiceName.Text = entry.ServiceName; textServiceType.Text = entry.ServiceClassName; if (entry.IsForeign) { ForeignService foreignService = (ForeignService)entry.Service; textServiceLocation.Text = "Foreign";//foreignService.Parent. } else { textServiceLocation.Text = "Local"; } // Update state of buttons if (entry.Service is IEngineHub) { buttonLaunchDisplay.Enabled = true; } else { buttonLaunchDisplay.Enabled = false; } if (entry.Service is Hub) { buttonLaunchLogViewer.Enabled = true; } else { buttonLaunchLogViewer.Enabled = false; } } }