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 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 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(); }