/// <summary>
        /// Occurs when the <see cref="ExclusionsControl"/> index has changed.
        /// </summary>
        /// <param name="sender">The <see cref="System.Object"/> that raised the event.</param>
        /// <param name="e">An <see cref="EnableButtonsEventArgs"/> containing event data.</param>
        private void ExclusionsControl_SelectedIndexChanged(object sender, EnableButtonsEventArgs e)
        {
            IPolicyExclusion exclusion = (IPolicyExclusion)e.Item.Tag;

            if (exclusion != null)
            {
                e.EnableButton  = !exclusion.Active;
                e.DisableButton = exclusion.Active;
            }
        }
        /// <summary>
        /// Occurs when the <see cref="ExclusionsControl"/> is enabling an item.
        /// </summary>
        /// <param name="sender">The <see cref="System.Object"/> that raised the event.</param>
        /// <param name="e">An <see cref="ItemEventArgs"/> containing event data.</param>
        private void ExclusionsControl_EnablingItem(object sender, ItemEventArgs e)
        {
            IPolicyExclusion exclusion = (IPolicyExclusion)e.Item.Tag;

            if (exclusion != null)
            {
                exclusion.Active = true;

                EnableListViewItem(e.Item);
            }
        }
        /// <summary>
        /// Occurs when the <see cref="ExclusionsControl"/> is removing an item.
        /// </summary>
        /// <param name="sender">The <see cref="System.Object"/> that raised the event.</param>
        /// <param name="e">An <see cref="System.EventArgs"/> containing event data.</param>
        private void ExclusionsControl_RemovingItem(object sender, ItemEventArgs e)
        {
            IPolicyExclusion exclusion = (IPolicyExclusion)e.Item.Tag;

            int removeIndex = int.MinValue;

            for (int index = 0; index < this.Exclusions.Count; index++)
            {
                if (exclusion == this.Exclusions[index])
                {
                    removeIndex = index;
                    break;
                }
            }

            if (removeIndex != int.MinValue)
            {
                this.Exclusions.RemoveAt(removeIndex);
            }
        }
        /// <summary>
        /// Occurs when the <see cref="ExclusionsControl"/> is editing an item.
        /// </summary>
        /// <param name="sender">The <see cref="System.Object"/> that raised the event.</param>
        /// <param name="e">An <see cref="System.EventArgs"/> containing event data.</param>
        private void ExclusionsControl_EditingItem(object sender, ItemEventArgs e)
        {
            IPolicyExclusion policy = (IPolicyExclusion)e.Item.Tag;

            using (BaseEditorDialog dialog = this.CreateEditorDialog())
            {
                dialog.EditMode = EditorMode.Edit;
                dialog.Value    = policy;

                if (dialog.ShowDialog(this) != DialogResult.OK)
                {
                    e.Cancel = true;
                }
                else
                {
                    // Update the policy description.
                    e.Item.Text = policy.Description;
                }
            }
        }
        /// <summary>
        /// Occurs when the <see cref="ExclusionsControl"/> is adding an item.
        /// </summary>
        /// <param name="sender">The <see cref="System.Object"/> that raised the event.</param>
        /// <param name="e">An <see cref="AddingItemEventArgs"/> containing event data.</param>
        private void ExclusionsControl_AddingItem(object sender, ItemEventArgs e)
        {
            using (BaseEditorDialog dialog = this.CreateEditorDialog())
            {
                dialog.EditMode = EditorMode.Add;

                if (dialog.ShowDialog(this) != DialogResult.OK)
                {
                    e.Cancel = true;
                }
                else
                {
                    IPolicyExclusion newExclusion = dialog.Value;
                    newExclusion.Active = true;

                    bool found = false;
                    foreach (IPolicyExclusion exclusion in this.Exclusions)
                    {
                        if (exclusion.CompareTo(newExclusion) == 0)
                        {
                            // The new exclusion already exists, notify the user and do not add it again.
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        this.Exclusions.Add(newExclusion);

                        e.Item.Text = newExclusion.Description;
                        e.Item.Tag  = newExclusion;
                    }

                    this.EnableSubmitButton();
                }
            }
        }