public void UpdatePages(ThreadPoolTimer timer = null) { _updateTimer?.Cancel(); _updateTimer = null; InvokeOnUIThread(async() => { TilePageCollection.Clear(); foreach (var category in PageUtil.GetPagesByCategory()) { // Display the category only if there are pages in it if (category.Value.Length == 0) { continue; } // Only display WDP pages if WDP is enabled if (category.Key == PageUtil.WdpCategory) { // Check if Device Portal is enabled. Call this asynchronously so we don't block the UI if we have to make a network call. bool wdpEnabled = false; await ThreadPool.RunAsync((s) => wdpEnabled = DevicePortalUtil.IsDevicePortalEnabled(), WorkItemPriority.Normal); if (!wdpEnabled) { continue; } } var gridItems = new List <TileGridItem>(); foreach (var descriptor in category.Value) { gridItems.Add(new TileGridItem(descriptor, useMDL2: _settings.UseMDL2Icons) { Width = _settings.AppTileWidth, Height = _settings.AppTileHeight, BackgroundColor = new SolidColorBrush(_settings.TileColor) }); } TilePageCollection.Add(new TilePageCategory { Category = category.Key, Pages = gridItems, }); } }); }