/// <summary> /// Browses for new stores to manage. /// </summary> private void BrowseStoreBTN_Click(object sender, EventArgs e) { try { string storeType = StoreTypeCB.SelectedItem as string; string storePath = null; if (storeType == CertificateStoreType.Directory) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "Select Certificate Store Directory"; dialog.RootFolder = Environment.SpecialFolder.MyComputer; dialog.ShowNewFolderButton = true; if (dialog.ShowDialog() != DialogResult.OK) { return; } storePath = dialog.SelectedPath; } if (storeType == CertificateStoreType.Windows) { CertificateStoreIdentifier store = new CertificateStoreTreeDlg().ShowDialog(null); if (store == null) { return; } storePath = store.StorePath; } if (String.IsNullOrEmpty(storePath)) { return; } bool found = false; for (int ii = 0; ii < StorePathCB.Items.Count; ii++) { if (String.Compare(storePath, StorePathCB.Items[ii] as string, StringComparison.OrdinalIgnoreCase) == 0) { StorePathCB.SelectedIndex = ii; found = true; break; } } if (!found) { StorePathCB.SelectedIndex = StorePathCB.Items.Add(storePath); } Utils.UpdateRecentFileList("CertificateStores:" + storeType, storePath, 16); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }