Esempio n. 1
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     try
     {
         Util.TranslateUtil.InitLanguage();
         txtConsole.Text = NetworkInterfaceHelper.GetActiveConnection();
         ReloadLanguage();
     }
     catch (Exception e1) {
         MessageBox.Show(this, e1.Message);
     }
 }
Esempio n. 2
0
        private void tsbApply_Click(object sender, EventArgs e)
        {
            if (TabProfiles.SelectedTab == tabProfile)
            {
                try
                {
                    if (lstProfiles.SelectedValue != null)
                    {
                        bool error = false;
                        if (!profileSelected.DhcpEnabled)
                        {
                            if (!(NetworkInterfaceHelper.SetIP(profileSelected.MacAddress, profileSelected.IpAddress, profileSelected.IpSubnet, profileSelected.DefaultIpGateway)))
                            {
                                MessageBox.Show(this, TranslateUtil.GetMsgErrorNetworkInterface(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                error = true;
                            }
                        }
                        else
                        {
                            new Thread(StartDHCPRenew).Start();
                        }

                        if (!profileSelected.DnsServerSearchOrder.Trim().Equals(String.Empty))
                        {
                            if (!(NetworkInterfaceHelper.SetDNS(profileSelected.MacAddress, profileSelected.DnsServerSearchOrder)))
                            {
                                MessageBox.Show(this, TranslateUtil.GetMsgErrorDNSNetworkInterface(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                error = true;
                            }
                        }
                        else
                        {
                            NetworkInterfaceHelper.SetDNSAutomatically(profileSelected.MacAddress);
                        }

                        if (!error && !profileSelected.DhcpEnabled)
                        {
                            MessageBox.Show(this, String.Format(TranslateUtil.GetMsgAppliedProfile(), ((Profile)lstProfiles.SelectedItem).ProfileName), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            txtConsole.Text = NetworkInterfaceHelper.GetActiveConnection();
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, TranslateUtil.GetMsgSelectProfile(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch {
                    MessageBox.Show(this, TranslateUtil.GetMsgErrorSetting(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
 private void StartDHCPRenew()
 {
     NetworkInterfaceHelper.SetEnabledDHCP(profileSelected.MacAddress);
     MessageBox.Show(this, String.Format(TranslateUtil.GetMsgAppliedProfile(), ((Profile)lstProfiles.SelectedItem).ProfileName), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     txtConsole.Text = NetworkInterfaceHelper.GetActiveConnection();
 }