private void buttonDoorGroupTabEditGroup_Click(object sender, EventArgs e)
 {
     Location loc = objects.getLocationByName((string)listBoxDoorGroupTabGroups.SelectedItem);
     if (loc != null)
     {
         //open a dialog to change the name or other details
         DoorGroupDialog dgd = new DoorGroupDialog(loc);
         if (dgd.ShowDialog() == DialogResult.OK)
         {
             // update the Door Group - OOP and database.
             loc.Name = dgd.location.Name;
             loc.Save();
             // redisplay
             initializeDoorGroupTab();
             listBoxDoorGroupTabGroups.SelectedItem = loc.Name;
         }
         dgd.Close();
     }
 }
 private void buttonDoorGroupTabNewGroup_Click(object sender, EventArgs e)
 {
     // use a dialog to create a new door group
     DoorGroupDialog dgd = new DoorGroupDialog();
     if (dgd.ShowDialog() == DialogResult.OK)
     {
         // update the OOP and the database
         Location loc = dgd.location;
         loc.Save();
         objects.locations.Add(loc);
         // redisplay
         initializeDoorGroupTab();
         listBoxDoorGroupTabGroups.SelectedItem = loc.Name;
     }
     dgd.Close();
 }
 private void buttonCreate_Click(object sender, EventArgs e)
 {
     DoorGroupDialog dgd = new DoorGroupDialog();
     DialogResult result = dgd.ShowDialog();
     if (result == DialogResult.OK)
     {
         Location loc = dgd.location;
         objects.locations.Add(loc);
         loc.Save();
         // update ui here
         TreeNode newNode = treeViewDoorGroup.Nodes.Add(loc.Name);
         bool isOdd = treeViewDoorGroup.Nodes.Count % 2 == 1;
         newNode.Tag = loc;
         newNode.BackColor = isOdd ? lightBlue : Color.White;
     }
     dgd.Dispose();
 }
示例#4
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();
        }
 private void buttonRename_Click(object sender, EventArgs e)
 {
     TreeNode node = treeViewDoorGroup.SelectedNode;
     Location loc = (Location)node.Tag;
     DoorGroupDialog dgd = new DoorGroupDialog(loc);
     DialogResult result = dgd.ShowDialog();
     if (result == DialogResult.OK)
     {
         loc.Save();
         // update ui here:
         node.Text = loc.Name;
     }
 }