wizardlee
wizardlee

Reputation: 911

How to update tile created by other app?

I have two app: one UI to create a tile with Create(), the other agent to update the tile with Update(). The 2 functions worked well in one app, ie. both in UI or both in agent. But if I put Create in UI and Update() in agent, Update() can not find the tile created by Create(). What's wrong? Thanks.

    private void Create()
    {
        ShellTile find = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("ID=shelltile"));
        StandardTileData date = new StandardTileData();
        date.Count = 10;
        if (find == null)
        {
            ShellTile.Create(new Uri("/MainPage.xaml?ID=shelltile", UriKind.Relative), date);
        }
    }
    private void Update()
    {
        ShellTile find = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("ID=shelltile"));
        if (find != null)
        {
            StandardTileData date = new StandardTileData();
            date.Title = "aaaaaaaaa";
            find.Update(date);
        }
    }

Upvotes: 0

Views: 203

Answers (1)

gregstoll
gregstoll

Reputation: 1318

Each app can only access its own tiles. If you want to update the tiles, you'll need to make a background agent in the same app. (note that a background agent can't create tiles, which leads me to believe this isn't what you're doing now)

Upvotes: 1

Related Questions