// Remove the specified adapter from the monitoredAdapters list, and disable the timer if the monitoredAdapters list is empty. public void StopMonitoring(NetworkAdapter adapter) { if (this.monitoredAdapters.Contains(adapter)) this.monitoredAdapters.Remove(adapter); if (this.monitoredAdapters.Count == 0) { timer.Enabled = false; bMonitoring = false; } }
// Enable the timer, and add the specified adapter to the monitoredAdapters list public void StartMonitoring(NetworkAdapter adapter) { if (!this.monitoredAdapters.Contains(adapter)) { this.monitoredAdapters.Add(adapter); adapter.init(); } timer.Enabled = true; }
public void _dispose() { netGraphControl.Controls.Clear(); netGraphControl.Dispose(); netGraphControl = null; lNet.Dispose(); lNet = null; Adapter = null; }
/// <summary> /// Enumerates network adapters installed on the computer. /// </summary> public void EnumerateNetworkAdapters(String[] sName) { NetworkInterface[] nicArr = NetworkInterface.GetAllNetworkInterfaces(); foreach (string name in sName) { NetworkInterface nic = Array.Find(nicArr, element => element.Name == name); if (nic != null && nic.OperationalStatus == OperationalStatus.Up) { NetworkAdapter adapter = new NetworkAdapter(nic); this.adapters.Add(adapter); } } }
public NetworkWorkload(string sName, NetworkAdapter Adapter) { _netGraphInit(sName); _label_init(); this.Adapter = Adapter; }