diff options
Diffstat (limited to 'Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs')
-rw-r--r-- | Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs index 6e19af8ed..dfaffed30 100644 --- a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs +++ b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs @@ -20,8 +20,10 @@ namespace LEDMixer private void LEDMixer_Load(object sender, EventArgs e) { - for (int i = 1; i <= 99; i++) - cbPort.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))); }); + cbPort.Items.Clear(); + cbPort.Items.AddRange(PortNames); cbPort.SelectedIndex = 0; |