private void listViewKeyValue_MouseDoubleClick(object sender, MouseEventArgs e) { if (listViewKeyValue.Items.Count > 0) { for (int i = 0; i < listViewKeyValue.Items.Count; i++) { if (listViewKeyValue.Items[i].Selected) { attributeText = listViewKeyValue.Items[i].Text; valueText = listViewKeyValue.Items[i].SubItems[1].Text; using (PopupUpdateForm popupUpdateForm = new PopupUpdateForm()) { popupUpdateForm.ControlKeyValue(); if (popupUpdateForm.ShowDialog() == DialogResult.OK) { if (!showAndUpdatePresenter.UpdateKeyAndValue(selectorText, selectorProperty.List, attributeText, PopupUpdateForm.attributeTextUp, PopupUpdateForm.valueTextUp)) { MessageBox.Show("Unable to update data try again!"); } else { listViewKeyValue.Items.Clear(); PopulateKeyValueList(selectorText); } } } } } } }
private void ListViewSubSelector_MouseDoubleClick(object sender, MouseEventArgs e) { if (listViewSubSelector.Items.Count > 0) { for (int i = 0; i < listViewSubSelector.Items.Count; i++) { if (listViewSubSelector.Items[i].Selected) { selectorText = listViewSubSelector.Items[i].Text; using (PopupUpdateForm popupUpdateForm = new PopupUpdateForm()) { popupUpdateForm.ControlSelector(); if (popupUpdateForm.ShowDialog() == DialogResult.OK) { string updatedSelector = PopupUpdateForm.selectorTextUp; if (!showAndUpdatePresenter.UpdateSelector(selectorText, updatedSelector, selectorProperty.List)) { MessageBox.Show("Unable to update data try again!"); } else { listViewSelector.Items.Clear(); PopulateSelectorList(); listViewSubSelector.Items.Clear(); if (updatedSelector.Contains(" ")) { int index = updatedSelector.IndexOf(" "); PopulateSubSelectorList(PopupUpdateForm.selectorTextUp.Substring(0, index)); } else { PopulateSubSelectorList(PopupUpdateForm.selectorTextUp); } listViewKeyValue.Items.Clear(); PopulateKeyValueList(PopupUpdateForm.selectorTextUp); } } } } } } }