public async Task UpdateAllSecondaryTilesIfHas() { try { var tiles = await TilesHelper.FindAllSecondaryTilesAsync(); foreach (var tile in tiles) { long deckId = 0; var success = long.TryParse(tile.TileId, out deckId); if (success) { var deck = GetDeck(deckId); TilesHelper.SendSecondaryTileNotification(tile.TileId, deck.NewCards.ToString(), deck.DueCards.ToString()); tile.VisualElements.BackgroundColor = GetColors(deck); await tile.UpdateAsync(); } } } catch (Exception e) { //App should not crash if any error happen Debug.WriteLine("DeckListViewModel.UpdateAllSecondaryTilesIfHas: " + e.Message); } }
private async void OnMenuFlyoutCreateDeckTileClick(object sender, RoutedEventArgs e) { base.IsEnabled = false; var tileId = deckShowContextMenu.Id.ToString(); SecondaryTile tile = TilesHelper.GenerateSecondaryTile(tileId, deckShowContextMenu.BaseName); tile.VisualElements.ShowNameOnSquare150x150Logo = true; tile.VisualElements.ShowNameOnSquare310x310Logo = true; tile.VisualElements.ShowNameOnWide310x150Logo = true; tile.VisualElements.BackgroundColor = DeckListViewModel.GetColors(deckShowContextMenu); await tile.RequestCreateAsync(); base.IsEnabled = true; TilesHelper.SendSecondaryTileNotification(tileId, deckShowContextMenu.NewCards.ToString(), deckShowContextMenu.DueCards.ToString()); }