private void AddConnectionTreeNode(string accountEndpoint, AccountSettings accountSettings) { try { DocumentClient client = new DocumentClient(new Uri(accountEndpoint), accountSettings.MasterKey, new ConnectionPolicy { ConnectionMode = accountSettings.ConnectionMode, ConnectionProtocol = accountSettings.Protocol }); DatabaseAccountNode dbaNode = new DatabaseAccountNode(accountEndpoint, client); this.treeView1.Nodes.Add(dbaNode); dbaNode.Tag = client.GetDatabaseAccountAsync().Result; } catch (Exception e) { Program.GetMain().SetResultInBrowser(null, e.ToString(), true); } }
private void AddConnectionTreeNode(string accountEndpoint, AccountSettings accountSettings) { try { string suffix = Constants.ApplicationName + "/" + Constants.ProductVersion; DocumentClient client = new DocumentClient(new Uri(accountEndpoint), accountSettings.MasterKey, new ConnectionPolicy { ConnectionMode = accountSettings.ConnectionMode, ConnectionProtocol = accountSettings.Protocol, UserAgentSuffix = suffix }); DatabaseAccountNode dbaNode = new DatabaseAccountNode(accountEndpoint, client); this.treeView1.Nodes.Add(dbaNode); // Update the map. DocumentClientExtension.AddOrUpdate(client.ServiceEndpoint.Host, accountSettings.IsNameBased); if (accountSettings.IsNameBased) { dbaNode.ForeColor = Color.Green; } else { dbaNode.ForeColor = Color.Blue; } // Set the tag to the DatabaseAccount resource object, this might fail if the service is not available. dbaNode.Tag = client.GetDatabaseAccountAsync().Result; } catch (Exception e) { Program.GetMain().SetResultInBrowser(null, e.ToString(), true); } }