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 OnAddRemove(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 (CertificateData 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();

            // Construct the new FileNamesString
            FileNamesString = "";
            List <CertificateData> certificateList = new List <CertificateData>();

            if (azureBlobSelector.BlobFileNames != null)
            {
                foreach (string fileName in azureBlobSelector.BlobFileNames)
                {
                    CertificateData certificateData = new CertificateData();
                    certificateData.LoadFromCerAzureBlob(ConnectionString, ContainerName, fileName, @"c:\temp\certificates");
                    certificateList.Add(certificateData);

                    if (FileNamesString.Length != 0)
                    {
                        FileNamesString += Separator;
                    }
                    FileNamesString += fileName;
                }
            }

            // Update the UI
            certificateList.Sort((x, y) => x.Hash.CompareTo(y.Hash));
            CertificateList.ItemsSource = certificateList;
        }