X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..d2d0e189ededbb417ca9b573e46fb622840ad07c:/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs index 34903f425..32543fc59 100644 --- a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs +++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs @@ -28,8 +28,10 @@ namespace CPUMonitor { AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\CPUMonitor"); - for (int i = 1; i <= 99; i++) - cmbComPort.Items.Add("COM" + i.ToString()); + String[] PortNames = System.IO.Ports.SerialPort.GetPortNames(); + Array.Sort(PortNames, delegate(string strA, string strB) { return int.Parse(strA.Substring(3)).CompareTo(int.Parse(strB.Substring(3))); }); + cmbComPort.Items.Clear(); + cmbComPort.Items.AddRange(PortNames); cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1; serSerialPort.PortName = cmbComPort.Text;