private void buttonCreateKeyset_Click(object sender, EventArgs e)
 {
     // use a dialog to create a new keyset
     KeysetDialog ksd = new KeysetDialog();
     if (ksd.ShowDialog() == DialogResult.OK)
     {
         // update the OOP and the database
         KeyRing ring = ksd.ring;
         ring.Save();
         objects.keyrings.Add(ring);
         // redisplay
         initializeKeySetTab();
         listBoxKeysets.SelectedItem = ring.Name;
     }
     ksd.Close();
 }
 private void buttonKeysetEdit_Click(object sender, EventArgs e)
 {
     // open a dialog to change the name or other details
     KeyRing ring = objects.getKeyRingByName((string)listBoxKeysets.SelectedItem);
     KeysetDialog ksd = new KeysetDialog(ring);
     if (ksd.ShowDialog() == DialogResult.OK)
     {
         // update the oop and the db
         ring.Name = ksd.ring.Name;
         ring.Save();
         // redisplay
         initializeKeySetTab();
         listBoxKeysets.SelectedItem = ring.Name;
     }
     ksd.Close();
 }
        private void buttonDoorGroupTabEditGroup_Click(object sender, EventArgs e)
        {
            // open a dialog to change the name or other details
            foreach (Location loc in objects.locations)
            {
                if (loc.Name == (string)listBoxDoorGroupTabGroups.SelectedItem)
                {
                    DoorGroupDialog dgd = new DoorGroupDialog(loc);
                    if (dgd.ShowDialog() == DialogResult.OK)
                    {
                        // update the Door Group - for now OOP only!
                        loc.Name = dgd.location.Name;
                        // redisplay
                        initializeDoorGroupTab();
                        listBoxKeysets.SelectedItem = loc.Name;
                    }
                    dgd.Close();
                }
            }

            KeyRing ring = objects.getKeyRingByName((string)listBoxKeysets.SelectedItem);
            KeysetDialog ksd = new KeysetDialog(ring);
            if (ksd.ShowDialog() == DialogResult.OK)
            {
                // update the keyset - for now OOP only!
                ring.Name = ksd.ring.Name;
                // redisplay
                initializeKeySetTab();
                listBoxKeysets.SelectedItem = ring.Name;
            }
            ksd.Close();
        }