Exemplo n.º 1
0
 public void ReadData()
 {
     ipAddress         = NetAdapt.GetIp(cboNIC.SelectedItem.ToString());
     txIP.Text         = ipAddress;
     subnet            = NetAdapt.GetMask(cboNIC.SelectedItem.ToString());
     txSubnet.Text     = subnet;
     checkboxDHCP      = NetAdapt.CheckDHCP(cboNIC.SelectedItem.ToString());
     chkDHCP.IsChecked = checkboxDHCP;
     if (checkboxDHCP)
     {
         txIP.IsEnabled     = false;
         txSubnet.IsEnabled = false;
     }
     else
     {
         txIP.IsEnabled     = true;
         txSubnet.IsEnabled = true;
     }
 }
Exemplo n.º 2
0
        private void afterStartApp()
        {
            ArrayList nicNames = NetAdapt.GetNICNames();

            cboNIC.Items.Clear();
            foreach (string nic in nicNames)
            {
                cboNIC.Items.Add(nic);
            }
            if (cboNIC.Items.Count > 0)
            {
                cboNIC.SelectedIndex = 0;
                ipAddress            = NetAdapt.GetIp(cboNIC.Text);
                txIP.Text            = ipAddress;
                subnet            = NetAdapt.GetMask(cboNIC.Text);
                txSubnet.Text     = subnet;
                checkboxDHCP      = NetAdapt.CheckDHCP(cboNIC.Text);
                chkDHCP.IsChecked = checkboxDHCP;


                Running = true;
            }
        }