private void modifyToolStripMenuItem_Click(object sender, EventArgs e) { EditEntityForm modifyEntityForm = new EditEntityForm(); modifyEntityForm.Text = "Modify entity"; VPNEntity originalEntity = new VPNEntity(); originalEntity.ConnectionAddr = this.listView_VPNSourceList.SelectedItems[0].SubItems[0].Text; originalEntity.AccountName = this.listView_VPNSourceList.SelectedItems[0].SubItems[1].Text; originalEntity.AccountPassword = this.listView_VPNSourceList.SelectedItems[0].SubItems[2].Text; originalEntity.DialType = this.listView_VPNSourceList.SelectedItems[0].SubItems[3].Text; originalEntity.Key = this.listView_VPNSourceList.SelectedItems[0].SubItems[4].Text; originalEntity.Supplementary = this.listView_VPNSourceList.SelectedItems[0].SubItems[5].Text; modifyEntityForm.SetFormByVPNEntity(originalEntity); if (modifyEntityForm.ShowDialog(this) == DialogResult.OK) { VPNEntity modifiedEntity = new VPNEntity(); modifiedEntity.ConnectionAddr = modifyEntityForm.InputAddress; modifiedEntity.AccountName = modifyEntityForm.InputAccountName; modifiedEntity.AccountPassword = modifyEntityForm.InputAccountPassword; modifiedEntity.DialType = modifyEntityForm.InputDialType; modifiedEntity.Key = modifyEntityForm.InputKey; modifiedEntity.Supplementary = modifyEntityForm.InputSupplementary; if (originalEntity.Equals(modifiedEntity)) { return; } else { controler.ModifyVpnEntityInSource(originalEntity, modifiedEntity); controler.SaveVPNSourceToFile(); controler.RefreshVPNListToView(); } } }