public Form1() { Refresher = new Refresher(); Refresher.AddListenerToConnectEvent(Refresh); Refresher.AddListenerToDiscnnectEvent(Refresh); Refresher.AddListerenToTimer(new EventHandler(Refresh)); Devices = USBManager.GetDeviceList(); InitializeComponent(); ViewDevices(); Refresher.Start(); }
private void ViewDevices() { if (!InvokeRequired) { var temp = USBManager.GetDeviceList(); if (!ListLogic.comparer(Devices, temp) || DevisesList.Items.Count == 0) { Clear(); Devices = temp; foreach (var device in Devices) { DevisesList.Items.Add((device.Letter == '\0') ? device.Name : (device.Letter + ": " + device.Name)); } } } else { Invoke(new Action(ViewDevices)); } }