private void policiesList_DoubleClick(object sender, System.EventArgs e)
        {
            AccessPolicy policy = (AccessPolicy)policiesList.SelectedItem;

            if (policy != null)
            {
                AddPolicyForm form = new AddPolicyForm();
                form.SetModify(policy.Name, policy.Document);

                DialogResult result = form.ShowDialog(this);
                if (result != DialogResult.Cancel)
                {
                    policy.Name     = form.PolicyName;
                    policy.Document = form.PolicyDoc;

                    bool success = policyDAO.UpdatePolicy(policy.Id, policy.Document, policy.Name);
                    if (success)
                    {
                        RefreshPolicyLists();
                    }
                    else
                    {
                        Error("Could not update policy.");
                    }
                }
            }
        }
        private void newPolicyButton_Click(object sender, System.EventArgs evt)
        {
            AddPolicyForm form   = new AddPolicyForm();
            DialogResult  result = form.ShowDialog(this);

            if (result != DialogResult.Cancel)
            {
                // "backup" the current clipboard contents
                object o = Clipboard.GetDataObject();
                Clipboard.SetDataObject(form.PolicyDoc, false);
                AccessPolicy policy = policyDAO.AddNewPolicy(form.PolicyName, form.PolicyDoc);
                if (policy != null)
                {
                    RefreshPolicyLists();
                    try
                    {
                        if (o != null)
                        {
                            Clipboard.SetDataObject(o, true);
                        }
                    }
                    catch (Exception /*e*/) {
                        // oh well
                    }
                }
                else
                {
                    Error("Could not create new policy. Your policy document was copied to the clipboard.");
                }
            }
        }