예제 #1
0
 private void mnuNewBlobContainer_Click(object sender, RoutedEventArgs e)
 {
     newContainer nc = new newContainer();
     nc.ShowDialog();
     if (!nc.cancelled)
     {
         this.Cursor = Cursors.Wait;
         AzureBlobStorage abs = new AzureBlobStorage(azAccount, string.Format("http://{0}.blob.core.windows.net", azAccount), azSharedKey, "SharedKey");
         Hashtable htMetaData = new Hashtable();
         htMetaData.Add("x-ms-meta-createdBy", "Finsel.AzureCommands");
         azureResults ar = abs.Containers(cmdType.put, nc.newContainerName, htMetaData);
         ProcessResults(ar);
         if (ar.Succeeded)
         {
             TreeViewItem tvI = new TreeViewItem();
             blobContainer bc = new blobContainer();
             bc.ContainerName = nc.newContainerName;
             tvI.Header = bc.ContainerName;
             tvI.Tag = bc;
             tvI.Items.Add("*");
             tvBlobs.Items.Add(tvI);
         }
         this.Cursor = Cursors.Arrow;
     }
 }
예제 #2
0
        private void LoadContainers()
        {
            this.Cursor = Cursors.Wait;
            tvBlobs.Items.Clear();

            AzureBlobStorage abs = new AzureBlobStorage(azAccount, string.Format("http://{0}.blob.core.windows.net", azAccount), azSharedKey, "SharedKey");
            azureResults ar = abs.GetContainerList("");
            if (ar.Succeeded)
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(ar.Body);
                XmlNodeList nodes = xdoc.SelectNodes("//Container");

                foreach (XmlNode node in nodes)
                {
                    TreeViewItem tvI = new TreeViewItem();
                    blobContainer bc = new blobContainer();
                    try{bc.ContainerName = node.SelectSingleNode("Name").InnerText;}
                    catch { }
                    try {bc.Etag = node.SelectSingleNode("Properties/Etag").InnerText;}
                    catch { }
                    try {bc.LeaseState = node.SelectSingleNode("Properties/LeaseState").InnerText;}
                    catch { }
                    try {bc.LeaseStatus = node.SelectSingleNode("Properties/LeaseStatus").InnerText;}
                    catch { }
                    try { bc.LastModified = node.SelectSingleNode("Properties/LastModified").InnerText; }
                    catch { }
                    tvI.Header = bc.ContainerName;
                    tvI.Tag = bc;
                    tvI.Items.Add("*");
                    tvBlobs.Items.Add(tvI);
                }
                mnuNewBlobContainer.IsEnabled = true;
                mnuDeleteContainer.IsEnabled = true;
            }
            ProcessResults(ar);
            this.Cursor = Cursors.Arrow;
        }