private void newButton_Button_Pressed(object sender, EventArgs e) { Material_Type_Form showForm = new Material_Type_Form(); if (showForm.ShowDialog() == DialogResult.OK) { if ((showForm.Display_Name.Length > 0) && (showForm.MODS_Type.Length > 0)) { listView1.Items.Add(new ListViewItem(new string[3] { showForm.Display_Name, showForm.MODS_Type, showForm.SobekCM_Genre })); } else { MessageBox.Show("Resource types require both a template value and MODS mapping.", "Invalid Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void editButton_Button_Pressed(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { Material_Type_Form showForm = new Material_Type_Form(listView1.SelectedItems[0].SubItems[0].Text, listView1.SelectedItems[0].SubItems[1].Text, listView1.SelectedItems[0].SubItems[2].Text); if (showForm.ShowDialog() == DialogResult.OK) { if ((showForm.Display_Name.Length > 0) && (showForm.MODS_Type.Length > 0)) { listView1.SelectedItems[0].SubItems[0].Text = showForm.Display_Name; listView1.SelectedItems[0].SubItems[1].Text = showForm.MODS_Type; listView1.SelectedItems[0].SubItems[2].Text = showForm.SobekCM_Genre; } else { MessageBox.Show("Resource types require both a template value and MODS mapping.", "Invalid Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }