Beispiel #1
0
 private void btnActivate_Click(object sender, RoutedEventArgs e)
 {
     if (chkDHCP.IsChecked == true)
     {
         NetAdapt.SetDHCP(cboNIC.SelectedItem.ToString());
     }
     else
     {
         if (checkSyntax(txIP.Text) && checkSyntax(txSubnet.Text))
         {
             NetAdapt.SetIP(txIP.Text, txSubnet.Text, cboNIC.SelectedItem.ToString());
         }
     }
     ReadData();
 }
Beispiel #2
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;
     }
 }
Beispiel #3
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;
            }
        }