/// <summary>
        /// Displays the dialog.
        /// </summary>
        public bool ShowDialog(CertificateStoreIdentifier defaultStore)
        {
            // save the default store (used when creating new bindings).
            m_defaultStore = defaultStore;

            if (m_defaultStore == null)
            {
                m_defaultStore           = new CertificateStoreIdentifier();
                m_defaultStore.StoreType = Utils.DefaultStoreType;
                m_defaultStore.StorePath = Utils.DefaultStorePath;
            }

            // populate the grid.
            foreach (SslCertificateBinding binding in HttpAccessRule.GetSslCertificateBindings())
            {
                AddRow(binding);
            }

            m_dataset.AcceptChanges();
            BindingsDV.DataSource = m_dataset.Tables[0].DefaultView;

            if (base.ShowDialog() == DialogResult.Cancel)
            {
                return(false);
            }

            return(true);
        }
        private void DeleteBindingMI_Click(object sender, EventArgs e)
        {
            try
            {
                if (BindingsDV.SelectedRows.Count == 0)
                {
                    return;
                }

                if (Ask("Are you sure you want to delete these bindings?"))
                {
                    foreach (DataGridViewRow row in BindingsDV.SelectedRows)
                    {
                        DataRowView           source  = row.DataBoundItem as DataRowView;
                        SslCertificateBinding binding = (SslCertificateBinding)source.Row[4];
                        HttpAccessRule.DeleteSslCertificateBinding(binding.IPAddress, binding.Port);
                    }

                    m_dataset.Tables[0].Clear();

                    // repopulate the grid.
                    foreach (SslCertificateBinding binding in HttpAccessRule.GetSslCertificateBindings())
                    {
                        AddRow(binding);
                    }

                    m_dataset.AcceptChanges();
                    BindingsDV.DataSource = m_dataset.Tables[0].DefaultView;
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }