private static void UpdateDeviceListFromIoTHub() { List <IDictionary <string, object> > devices = IoTHubHelper.ListDevices(100); if (devices != null) { foreach (IDictionary <string, object> device in devices) { AddToDeviceList(device); } // Clean up the list of devices removing devices that are no longer provisionned in IoT Hub devicesList.RemoveAll(device => devices.Find(item => item["guid"].ToString() == device.guid) == null); Global.globalSettings.DevicesListRefreshed = true; } }