private void btAdd_Click(object sender, EventArgs e) { if (lvDevices.SelectedItems.Count > 0) { INatDevice device = GetDeviceByUUID(lvDevices.SelectedItems[0].SubItems[3].Text); AddMapping map = new AddMapping(); map.ShowDialog(); if (map.success) { if (map.protocol == AddMapping.AddPortOptions.Both) { AddMap(ref device, Protocol.Tcp, map.localport, map.publicport, map.description); AddMap(ref device, Protocol.Udp, map.localport, map.publicport, map.description); } else if (map.protocol == AddMapping.AddPortOptions.TCP) { AddMap(ref device, Protocol.Tcp, map.localport, map.publicport, map.description); } else if (map.protocol == AddMapping.AddPortOptions.UDP) { AddMap(ref device, Protocol.Udp, map.localport, map.publicport, map.description); } UpdateMappings(lvDevices.SelectedItems[0].SubItems[3].Text); } } else { MessageBox.Show("Please select a device from the devices list to add the portmap to", "Oops..."); } }