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 buttonCreate_Click(object sender, EventArgs e)
 {
     // open a dialog to create
     KeysetDialog ksd = new KeysetDialog();
     DialogResult result = ksd.ShowDialog();
     if (result == DialogResult.OK)
     {
         // get the new ring from the dialog.
         KeyRing ring = ksd.ring;
         objects.keyrings.Add(ring);
         ring.Save();
         // now create the node in the ui
         bool isOdd = treeViewRings.Nodes.Count % 2 == 0;
         TreeNode newNode = treeViewRings.Nodes.Add(ring.Name);
         newNode.Tag = ring;
         newNode.BackColor = isOdd ? lightBlue : Color.White;
     }
     ksd.Dispose();
 }
 private void buttonRename_Click(object sender, EventArgs e)
 {
     // open a dialog to rename
     TreeNode node = treeViewRings.SelectedNode;
     KeyRing ring = (KeyRing)node.Tag;
     KeysetDialog ksd = new KeysetDialog(ring);
     DialogResult result = ksd.ShowDialog();
     if (result == DialogResult.OK)
     {
         // ring modified in place, just save.
         ring.Save();
         node.Text = ring.Name;
     }
     ksd.Dispose();
 }
 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();
 }
Esempio n. 5
0
        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();
        }