private void butMap_Click(object sender, EventArgs e) { // Create a mapping PolicyMapping map = new PolicyMapping(); string[] s = lbIssuerPolicies.SelectedItem.ToString().Split('(', ')'); map.issuerOid = s[0]; map.issuerPolicyName = s[1]; // get subject oid GetPolicyShort subjectPolicy = new GetPolicyShort(); if (subjectPolicy.ShowDialog() == DialogResult.OK) { map.subjectOid = subjectPolicy.oid; map.subjectPolicyName = subjectPolicy.name; mapping.Mappings.Add(map); lbMappings.Items.Add(map.issuerOid + " (" + map.issuerPolicyName + ") -> " + map.subjectOid + " (" + map.subjectPolicyName + ")"); } }
private void mappings_DoubleClick(object sender, EventArgs e) { GetPolicyShort subjectPolicy = new GetPolicyShort() { oid = mapping.Mappings[lbMappings.SelectedIndex].subjectOid, name = mapping.Mappings[lbMappings.SelectedIndex].subjectPolicyName }; if (subjectPolicy.ShowDialog() == DialogResult.OK) { PolicyMapping map = new PolicyMapping() { issuerOid = mapping.Mappings[lbMappings.SelectedIndex].issuerOid, issuerPolicyName = mapping.Mappings[lbMappings.SelectedIndex].issuerPolicyName }; map.subjectOid = subjectPolicy.oid; map.subjectPolicyName = subjectPolicy.name; mapping.Mappings.RemoveAt(lbMappings.SelectedIndex); mapping.Mappings.Add(map); lbMappings.Items.RemoveAt(lbMappings.SelectedIndex); lbMappings.Items.Add(map.issuerOid + " (" + map.issuerPolicyName + ") -> " + map.subjectOid + " (" + map.subjectPolicyName + ")"); } }