Jarrette
Jarrette

Reputation: 1095

different data for different live tiles in the same app?

I'm trying to create an interface where a user can create data that streams to the application tile, the "secondary" tile, and/or a "tertiary" tile. What's happening, however, is that when I update one of the three tiles, ALL of the tiles update with that same stream of data... Is this a restriction that is in place with live tiles, or am I missing something?

Here's a snippet of what I'm trying to do....

            ShellTile tile = null;
            StandardTileData tileData = null;

            switch (tileInfo.type)
            {
                case "Application":
                    tile = ShellTile.ActiveTiles.First();
                    tileData = new StandardTileData
                    {
                        BackBackgroundImage = new Uri(isoStoreTileImage, UriKind.Absolute)
                    };
                    // If the file already exists, update it.
                    if (tile != null)
                    {
                        tile.Update(tileData);
                    }
                    break;
                case "Secondary":
                    tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Secondary"));
                    tileData = new StandardTileData
                    {
                        BackgroundImage = new Uri(isoStoreTileImage, UriKind.Absolute)
                    };
                    // If the file already exists, update it.
                    if (tile != null)
                    {
                        tile.Update(tileData);
                    }
                    else
                    {
                        // Otherwise, create a new tile. 
                        ShellTile.Create(new Uri(tileInfo.uri, UriKind.Relative), tileData);
                    }
                    break;
                case "Tertiary":
                    tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Tertiary"));
                    tileData = new StandardTileData
                    {
                        BackgroundImage = new Uri(isoStoreTileImage, UriKind.Absolute)
                    };
                    // If the file already exists, update it.
                    if (tile != null)
                    {
                        tile.Update(tileData);
                    }
                    else
                    {
                        // Otherwise, create a new tile. 
                        ShellTile.Create(new Uri(tileInfo.uri, UriKind.Relative), tileData);
                    }
                    break;
            }

Upvotes: 0

Views: 290

Answers (1)

Claus Jørgensen
Claus Jørgensen

Reputation: 26355

You're using the same isoStoreTileImage variable for all 3 StandardTileData instances. So that means you'll be overriding the same image.

Wild guess says you're using the same image URI for all 3 tiles, and thus updating them with the same data ;-)

Upvotes: 1

Related Questions