private void btnDHCP_Click(object sender, EventArgs e) { Dictionary <string, string> nics = NetworkManagement.getNetworkcardDescriptionAndMacAddresses(); var xxx = nics.ToArray(); NetworkManagement.enableDHCP(xxx[0].Key); }
private void BuildBaloonText() { trayTimer = new Timer(); trayTimer.Interval = 2000; trayTimer.Enabled = false; trayTimer.Tick += new EventHandler(trayTimer_Tick); BalloonShown = false; var nicList = NetworkManagement.getNetworkcardDescriptionAndMacAddresses(); StringBuilder nicInfo = new StringBuilder(); foreach (var nic in nicList.Keys.ToList()) { nicInfo.AppendLine(nicList[nic]); var nicConfig = NetworkManagement.getNetworkInfoBasedOnNIC(nic); foreach (var ip in nicConfig["IPAddress"].ToString().Split(',')) { nicInfo.AppendLine("IP " + Regex.Replace(ip, @"\s+", "")); } nicInfo.AppendLine("Subnet " + nicConfig["IPSubnet"].ToString()); nicInfo.AppendLine("DFGate " + nicConfig["DefaultIPGateway"].ToString()); } notifyIcon.BalloonTipText = nicInfo.ToString(); notifyIcon.Text = "Network Info"; }