X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..e39f3378a21ae5076e8c49bc728c20e436e3a69f:/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs?ds=inline 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;