public void OnExplore(object sender,EventArgs e) { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = false; string serviceNamespace = m_NamespaceTextBox.Text; if(String.IsNullOrEmpty(serviceNamespace)) { MessageBox.Show("You need to provide a service namespace","Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error); m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true; Cursor.Current = currentCursor; return; } if(Graphs.ContainsKey(serviceNamespace.ToLower()) == false) { LogonDialog dialog = new LogonDialog(m_NamespaceTextBox.Text,DefaultIssuer); dialog.ShowDialog(); if(dialog.Secret == null) { m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true; Cursor.Current = currentCursor; return; } try { Graphs[serviceNamespace.ToLower()] = new ServiceBusGraph(serviceNamespace,dialog.Issuer,dialog.Secret); } catch(Exception exception) { MessageBox.Show("Invalid namespace name: " + exception.Message,"Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error); m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true; Cursor.Current = currentCursor; return; } } SplashScreen splash = new SplashScreen(Resources.Progress); try { Application.DoEvents(); ServiceBusNode[] nodes = Graphs[serviceNamespace.ToLower()].Discover(); AddNodesToTree(m_ServiceBusTree,nodes); DisplayNamespaceControl(serviceNamespace); } catch(Exception exception) { MessageBox.Show("Some error occurred discovering the service namespace: " + exception.Message,"Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error); for(int index = 0;index < m_ServiceBusTree.Nodes.Count;index++) { if(m_ServiceBusTree.Nodes[index].Text == serviceNamespace) { m_ServiceBusTree.Nodes.Add(new NamespaceTreeNode(this,serviceNamespace,ServiceError)); m_ServiceBusTree.Nodes.RemoveAt(index); break; } } } finally { splash.Close(); m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true; Cursor.Current = currentCursor; } }
void ExploreServiceBus() { string mexAddress = m_MexAddressTextBox.Text; if(IsServiceBusAddress(mexAddress)) { if(m_NamespaceCredentials.ContainsKey(ServiceBusHelper.ExtractNamespace(new Uri(mexAddress))) == false) { OnServiceBusLogOn(this,EventArgs.Empty); } } SplashScreen splash = new SplashScreen(Resources.Progress); try { ExploreServiceBus(mexAddress); } finally { splash.Close(); m_ExploreButton.Enabled = true; } }
void OnDiscover(object sender,EventArgs e) { m_DiscoverButton.Enabled = false; DisplayBlankControl(); string currentAddress = m_MexAddressTextBox.Text; SplashScreen splash = new SplashScreen(Resources.Progress); try { DiscoverIntranet(); DiscoverServiceBus(); } finally { m_MexAddressTextBox.Text = currentAddress; splash.Close(); m_DiscoverButton.Enabled = true; } }
void OnExplore(object sender,EventArgs e) { m_ExploreButton.Enabled = false; string mexAddress = m_MexAddressTextBox.Text; if(String.IsNullOrEmpty(mexAddress)) { return; } DisplayBlankControl(); if(IsServiceBusAddress(mexAddress)) { ExploreServiceBus(); return; } SplashScreen splash = new SplashScreen(Resources.Progress); try { Explore(mexAddress); } finally { splash.Close(); m_ExploreButton.Enabled = true; } }
void OnExplore(object sender,EventArgs e) { m_ExploreButton.Enabled = false; string mexAddress = m_MexAddressTextBox.Text; if(String.IsNullOrEmpty(mexAddress)) { Debug.Assert(false,"Empty address"); } m_MexTree.Nodes.Clear(); DisplayBlankControl(); SplashScreen splash = new SplashScreen(Resources.Progress); try { Uri address = new Uri(mexAddress); ServiceEndpointCollection endpoints = null; if(address.Scheme == "http") { HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement(); httpBindingElement.MaxReceivedMessageSize *= MessageMultiplier; //Try the HTTP MEX Endpoint try { endpoints = GetEndpoints(httpBindingElement); } catch {} //Try over HTTP-GET if(endpoints == null) { string httpGetAddress = mexAddress; if(mexAddress.EndsWith("?wsdl") == false) { httpGetAddress += "?wsdl"; } CustomBinding binding = new CustomBinding(httpBindingElement); MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding); MetadataSet metadata = MEXClient.GetMetadata(new Uri(httpGetAddress),MetadataExchangeClientMode.HttpGet); MetadataImporter importer = new WsdlImporter(metadata); endpoints = importer.ImportAllEndpoints(); } } if(address.Scheme == "https") { HttpsTransportBindingElement httpsBindingElement = new HttpsTransportBindingElement(); httpsBindingElement.MaxReceivedMessageSize *= MessageMultiplier; //Try the HTTPS MEX Endpoint try { endpoints = GetEndpoints(httpsBindingElement); } catch { } //Try over HTTP-GET if(endpoints == null) { string httpsGetAddress = mexAddress; if(mexAddress.EndsWith("?wsdl") == false) { httpsGetAddress += "?wsdl"; } CustomBinding binding = new CustomBinding(httpsBindingElement); MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding); MetadataSet metadata = MEXClient.GetMetadata(new Uri(httpsGetAddress),MetadataExchangeClientMode.HttpGet); MetadataImporter importer = new WsdlImporter(metadata); endpoints = importer.ImportAllEndpoints(); } } if(address.Scheme == "net.tcp") { TcpTransportBindingElement tcpBindingElement = new TcpTransportBindingElement(); tcpBindingElement.MaxReceivedMessageSize *= MessageMultiplier; endpoints = GetEndpoints(tcpBindingElement); } if(address.Scheme == "net.pipe") { NamedPipeTransportBindingElement ipcBindingElement = new NamedPipeTransportBindingElement(); ipcBindingElement.MaxReceivedMessageSize *= MessageMultiplier; endpoints = GetEndpoints(ipcBindingElement); } ProcessMetaData(endpoints); } catch { m_MexTree.Nodes.Clear(); m_Root = new ServiceNode(this,"Invalid Base Address",ServiceError,ServiceError); m_MexTree.Nodes.Add(m_Root); return; } finally { splash.Close(); m_ExploreButton.Enabled = true; } }