private void opencontactbttn_Click(object sender, EventArgs e) { switch (System.IO.File.Exists(CreateContactPath())) { case true: DazzleDesign_Contact_Reader.Reader ContactReader = new DazzleDesign_Contact_Reader.Reader(Mode.Mode.EditModeEnum.InternalEdit,CreateContactPath(),iDLabel1.Text); if (ContactReader.ShowDialog() == DialogResult.OK) { ReadData(); } break; case false: if (MessageBox.Show("This contact does not exist in the file system. Entry will be removed from the database.", "DazzleDesign Contacts", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { contactsBindingSource.RemoveCurrent(); WriteData(); } break; } }
private void newcontactbttn_Click(object sender, EventArgs e) { switch (groupsBindingSource.Count) { default: DazzleDesign_Contact_Reader.Reader Reader = new DazzleDesign_Contact_Reader.Reader(Mode.Mode.EditModeEnum.AddNew, "", ""); if (Reader.ShowDialog() == DialogResult.OK) { ReadData(); } break; case 0: if (MessageBox.Show("You must first create a group before adding contacts. Would you like to create one now?", "No Group Created", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { GroupManager GroupManager = new GroupManager(false); if (GroupManager.ShowDialog() == DialogResult.OK) { ReadData(); } } break; } }