/// <summary>
        /// Enumerates network adapters installed on the computer.
        /// </summary>
        private void EnumerateNetworkAdapters()
        {
            PerformanceCounterCategory category = new PerformanceCounterCategory("Network Interface");

            string[] temp = category.GetInstanceNames();

            foreach (string name in temp)
            {
                string found = _myNetworkAdapters.Find(delegate(string s) { if (name.StartsWith(s)) { return true; } return false; });
                if (found == null | found == "")
                {
                    continue;
                }

                // Create an instance of NetworkAdapter class, and create performance counters for it.
                NetworkAdapter adapter = new NetworkAdapter(name);
                adapter.dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", name);
                adapter.ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", name);
                this.adapters.Add(adapter);			// Add it to ArrayList adapter
            }
        }
 // 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;
 }
        private double IsAcceptedInterface(NetworkAdapter na, Type type)
        {

            if (type == Type.Download)
            {
                return na.DownloadSpeed;
            }
            else if (type == Type.Upload)
            {
                return na.UploadSpeed;
            }
            else
            {
                return 0.0;
            }

        }
 // 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;
 }