X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..3c1b28cf5ff16fede61f2abf37d5616f3e661036:/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs?ds=sidebyside diff --git a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs index 43cbef88c..02d83e856 100644 --- a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs +++ b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs @@ -23,8 +23,10 @@ namespace TestWinForms Messenger = new MessengerAPI.Messenger(); AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\MailNotifier"); - 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;