private void resumeSession()
        {
            //try
            //{
            ManagementObjectSearcher searcher =
                new ManagementObjectSearcher("root\\CIMV2",
                                             "SELECT * FROM Win32_PnPEntity");

            portScores = new Dictionary <string, int>();
            Items.Clear();
            var o1 = searcher.Get();
            var o2 = o1.Cast <ManagementObject>();
            var o3 = o2.ToList();

            foreach (var qo in o3)
            {
                if (qo == null)
                {
                    continue;
                }
                if (qo["Caption"] == null)
                {
                    continue;
                }
                var queryObj = qo["Caption"].ToString();
                try
                {
                    if (queryObj == null)
                    {
                        continue;
                    }
                    if (queryObj.Contains("COM"))
                    {
                        string port = queryObj;
                        if (portScores.ContainsKey(port))
                        {
                            continue;
                        }
                        portScores.Add(port, portNameScore(port));
                        Items.Add(port);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            //}
            //catch (Exception ex)
            //{
            //}


            DevicesRefreshed?.Invoke(this, null);
            Text = BestPort;
        }
 private void DebugChannelAddressesCB_DevicesRefreshed(object sender, EventArgs e)
 {
     DevicesRefreshed?.Invoke(this, new EventArgs());
 }