void Background_LoadQueuesCompleted(object sender, RunWorkerCompletedEventArgs e) { List<TreeItem> items = new List<TreeItem>(); TreeItem tvi; foreach (CloudQueue queue in Queues) { tvi = new TreeItem(); tvi.Text = NormalizeQueueName(queue.Uri.LocalPath.Substring(1)); tvi.Image = new BitmapImage(new Uri("/Images/Queue.png", UriKind.Relative)); tvi.Tag = queue; items.Add(tvi); } QueueNodes = items; base.OnPropertyChanged("Folders"); if (ViewQueuesErrors == 0) { ClearStatus(); } ListSpinnerVisible = Visibility.Collapsed; }
void Background_LoadTablesCompleted(object sender, RunWorkerCompletedEventArgs e) { List<TreeItem> items = new List<TreeItem>(); TreeItem tvi; foreach (string table in Tables) { tvi = new TreeItem(); tvi.Text = table; tvi.Image = new BitmapImage(new Uri("/Images/Table.png", UriKind.Relative)); tvi.Tag = table; items.Add(tvi); } TableNodes = items; base.OnPropertyChanged("Folders"); if (ViewTablesErrors == 0) { ClearStatus(); } ListSpinnerVisible = Visibility.Collapsed; }
void Background_LoadContainersCompleted(object sender, RunWorkerCompletedEventArgs e) { int upgraded = 0; TreeItem tvi; List<TreeItem> items = new List<TreeItem>(); foreach (CloudBlobContainer container in Containers) { tvi = new TreeItem(); tvi.Text = NormalizeContainerName(container.Uri.LocalPath.Substring(1)); try { System.Diagnostics.Debug.Print(container.Name); if (container.GetPermissions().PublicAccess != BlobContainerPublicAccessType.Off) { tvi.Image = new BitmapImage(new Uri("/Images/Folder24.png", UriKind.Relative)); } else { tvi.Image = new BitmapImage(new Uri("/Images/LockedFolder24.png", UriKind.Relative)); } } catch (InvalidOperationException ex) { // This means we encountered an old-style container with permissions // set the old way (true/false), prior to the breaking change // Reset the permissions so the problem goes away. BlobContainerPermissions perms = new BlobContainerPermissions(); if (ex.Message.Contains("True")) { perms.PublicAccess = BlobContainerPublicAccessType.Blob; tvi.Image = new BitmapImage(new Uri("/Images/LockedFolder24.png", UriKind.Relative)); } else { perms.PublicAccess = BlobContainerPublicAccessType.Off; tvi.Image = new BitmapImage(new Uri("/Images/Folder24.png", UriKind.Relative)); } container.SetPermissions(perms); } tvi.Tag = container; items.Add(tvi); } ContainerNodes = items; base.OnPropertyChanged("Folders"); if (ViewBlobErrors == 0) { if (upgraded > 0) { ReportWarning("Upgraded " + numberof(upgraded, "container", "containers") + " to current standards"); } else { ClearStatus(); } } if (!BlobContainersUpgraded) { BlobContainersUpgraded = true; Account.BlobContainersUpgraded = true; AccountViewModel avm = MainWindow.GetAccount(Account.Name); if (avm != null) { avm.BlobContainersUpgraded = true; MainWindow.SaveConfiguration(); } } ListSpinnerVisible = Visibility.Collapsed; }