Exemple #1
0
 private void onLoadButton(object sender, MouseEventArgs e)
 {
     if (profileList.SelectedIndex >= 0)
     {
         NetworkConfig nc = networkconfigs.ElementAt(profileList.SelectedIndex);
         updateDisplayConfig(nc);
     }
 }
Exemple #2
0
 private void updateDisplayConfig(NetworkConfig nc)
 {
     profileBox.Text        = nc.name;
     interfaceComboBox.Text = nc.interfaceName;
     dhcpCheckBox.Checked   = nc.dhcp;
     profileIpaddress.Text  = nc.ip;
     profileMask.Text       = nc.mask;
     profileGateway.Text    = nc.gateway;
     profileMainDNS.Text    = nc.maindns;
     profileSecondDNS.Text  = nc.seconddns;
 }
Exemple #3
0
        private void onSaveButton(object sender, MouseEventArgs e)
        {
            string pname      = profileBox.Text;
            string pinterface = interfaceComboBox.Text;
            string pip        = profileIpaddress.Text;
            string pmask      = profileMask.Text;
            string pgateway   = profileGateway.Text;
            string pmaindns   = profileMainDNS.Text;
            string pseconddns = profileSecondDNS.Text;
            bool   dhcp       = dhcpCheckBox.Checked;

            if (isProfileOk())
            {
                NetworkConfig nc    = new NetworkConfig(pname, pinterface, dhcp, pip, pmask, pgateway, pmaindns, pseconddns);
                int           find  = -1;
                int           index = 0;
                foreach (NetworkConfig t in networkconfigs)
                {
                    if (t.name.Equals(pname))
                    {
                        find = index;
                        break;
                    }
                    index++;
                }

                if (find > -1)
                {
                    networkconfigs.RemoveAt(find);
                    networkconfigs.Insert(find, nc);
                }
                else
                {
                    networkconfigs.Add(nc);
                }
                updateAllConfig();
            }
        }