private void btnGetTables_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; cbTables.Items.Clear(); cbTables.Text = ""; AzureTableStorage ats = new AzureTableStorage(txtAccount.Text, txtEndpoint.Text, txtSharedKey.Text, "SharedKey"); azureResults ar = ats.GetTableList(); if (ar.Succeeded) { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(ar.Body); //Instantiate an XmlNamespaceManager object. System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xdoc.NameTable); //Add the namespaces used in books.xml to the XmlNamespaceManager. xmlnsManager.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices"); xmlnsManager.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"); XmlNodeList nodes = xdoc.SelectNodes("//d:TableName", xmlnsManager); foreach (XmlNode node in nodes) { cbTables.Items.Add(node.InnerText); } } ProcessResults(ar); this.Cursor = Cursors.Default; }
private void click_Tables(object sender, RoutedEventArgs e) { AzureTableStorage ats = new AzureTableStorage(azAccount, azEndPoint, azSharedKey, "SharedKey"); azureResults ar = new azureResults(); if (e.Source.ToString().StartsWith("System.Windows.Controls.Button")) { this.Cursor = Cursors.Wait; if (e.Source == btnGet) Process(cmdType.get); else if (e.Source == btnPut) Process(cmdType.put); else if (e.Source == btnPost) Process(cmdType.post); else if (e.Source == btnDelete) Process(cmdType.delete); else if (e.Source == btnMerge) Process(cmdType.merge); else if (e.Source == btnQuery) { string tableName = cbTables.Text; string filter = txtDocumentData.Text; string parameters = txtTParameters.Text; if (filter.StartsWith("?")) filter = filter.Substring(1); if (!filter.StartsWith("$filter=")) filter = string.Format("$filter={0}", filter); if (parameters != string.Empty) { if (parameters.StartsWith("?")) parameters = parameters.Substring(1); if (!parameters.StartsWith("&")) parameters = string.Format("&{0}", parameters); filter = string.Format("{0}{1}", filter, parameters); } ar = ats.Entities(cmdType.get, tableName, "", "", "", filter); ProcessResults(ar); } else if (e.Source == btnGetTables) { cbTables.Items.Clear(); cbTables.Text = ""; ar = ats.GetTableList(); if (ar.Succeeded) { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(ar.Body); //Instantiate an XmlNamespaceManager object. System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xdoc.NameTable); //Add the namespaces used in books.xml to the XmlNamespaceManager. xmlnsManager.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices"); xmlnsManager.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"); XmlNodeList nodes = xdoc.SelectNodes("//d:TableName", xmlnsManager); foreach (XmlNode node in nodes) { cbTables.Items.Add(node.InnerText); } } ProcessResults(ar); } this.Cursor = Cursors.Arrow; } }