同一应用程序中不同动态图块的数据不同?

发布于 2024-12-09 05:26:38 字数 2378 浏览 1 评论 0原文

我正在尝试创建一个界面,用户可以在其中创建流到应用程序图块、“辅助”图块和/或“第三”图块的数据。然而,发生的情况是,当我更新三个图块之一时,所有图块都会使用相同的数据流进行更新...这是实时图块的限制,还是我遗漏了某些内容?

这是我正在尝试做的事情的一个片段......

            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;
            }

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;
            }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我的黑色迷你裙 2024-12-16 05:26:38

您对所有 3 个 StandardTileData 实例使用相同的 isoStoreTileImage 变量。所以这意味着您将覆盖同一个图像。

大胆猜测说您对所有 3 个图块使用相同的图像 URI,因此使用相同的数据更新它们;-)

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 ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文