aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs')
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs6
1 files changed, 4 insertions, 2 deletions
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<String>(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;