예제 #1
0
 private void AddListItem(NatDeviceWrapper dev)
 {
     if (lbNatDevices.InvokeRequired)
     {
         lbNatDevices.Invoke((Action <NatDeviceWrapper>)AddListItem, dev);
     }
     else
     {
         lbNatDevices.Items.Add(dev);
         if (lbNatDevices.Items.Count == 1)
         {
             lbNatDevices.SelectedIndex = 0;
         }
     }
 }
예제 #2
0
        public DeviceForm(NatDeviceWrapper dev)
        {
            this.dev = dev;

            InitializeComponent();

            Text = dev.ToString();
            cbProtocol.SelectedIndex = 0;
            lblStatus.Text           = "";
            if (dev.Type == NatProtocol.Pmp)
            {
                lbActiveMappings.Enabled  = false;
                btnRefresh.Enabled        = btnRefresh.Visible = false;
                btnDeleteSelected.Enabled = btnDeleteSelected.Visible = false;
                btnDeleteAll.Enabled      = btnDeleteAll.Visible = false;
                txtDescription.Text       = "Not Supported with NAT-PMP";
                txtDescription.Enabled    = false;
                lblActiveMappings.Text    = "NAT-PMP protocol does not support listing active mappings or setting the Description string.";
            }
        }
예제 #3
0
        private void NatUtility_DeviceFound(object sender, DeviceEventArgs e)
        {
            NatDeviceWrapper dev = new NatDeviceWrapper(e.Device, e.Device.GetExternalIP(), e.Device.NatProtocol);

            AddListItem(dev);
        }