private void OnManageInstallList(object sender, RoutedEventArgs e) { Window parentWindow = FindParentWindow(); if (parentWindow == null) { throw new Exception("Error: CertificateSelector must be a child of a Window."); } // Gather the currently 'desired' certificate file names. List <string> currentBlobFileNames = new List <string>(); if (CertificateList.ItemsSource != null) { foreach (CertificateDetails certificateData in CertificateList.ItemsSource) { currentBlobFileNames.Add(certificateData.FileName); } } // Show contents of the container, and make the ones in currentBlobFileNames as selected. AzureBlobSelector azureBlobSelector = new AzureBlobSelector(currentBlobFileNames, ConnectionString, ContainerName, ".cer"); azureBlobSelector.Owner = parentWindow; azureBlobSelector.ShowDialog(); List <CertificateSummary> certsToInstall = new List <CertificateSummary>(); List <CertificateDetails> certificateList = new List <CertificateDetails>(); if (azureBlobSelector.BlobFileNames != null) { foreach (string blobName in azureBlobSelector.BlobFileNames) { string tempFullFileName = Path.GetTempFileName(); AzureStorageHelpers.DownloadAzureFile(ConnectionString, ContainerName, blobName, tempFullFileName); // Build the data used for UI... CertificateDetails certificateData = new CertificateDetails(); certificateData.LoadFromCertificateFile(tempFullFileName, blobName); certificateList.Add(certificateData); // Build the data used for callers... (ToDo: we should not have two lists here). CertificateSummary certificateSummary = new CertificateSummary(); certificateSummary.Hash = certificateData.Hash; certificateSummary.StorageFileName = ContainerName + "\\\\" + blobName; certificateSummary.State = CertificatesDataContract.JsonStateInstalled; certsToInstall.Add(certificateSummary); } } _certsToInstall = certsToInstall; // Update the UI certificateList.Sort((x, y) => x.Hash.CompareTo(y.Hash)); CertificateList.ItemsSource = certificateList; }
private void OnExportDetails(object sender, RoutedEventArgs e) { if (ExportCertificateDetails != null) { Button btn = (Button)sender; CertificateDetails certificateData = (CertificateDetails)btn.DataContext; ExportCertificateDetails(this, certificateData); } }
private void OnShowDetails(object sender, RoutedEventArgs e) { if (ShowCertificateDetails != null) { Button btn = (Button)sender; CertificateDetails certificateData = (CertificateDetails)btn.DataContext; if (!certificateData.DetailsAvailable) { string blobName = certificateData.Hash + ".json"; string certificateDetailsFile = Path.GetTempFileName(); AzureStorageHelpers.DownloadAzureFile(ConnectionString, ContainerName, blobName, certificateDetailsFile); certificateData.LoadFromJsonFile(certificateDetailsFile, blobName); } ShowCertificateDetails(this, certificateData); } }