同一应用程序中不同动态图块的数据不同?
我正在尝试创建一个界面,用户可以在其中创建流到应用程序图块、“辅助”图块和/或“第三”图块的数据。然而,发生的情况是,当我更新三个图块之一时,所有图块都会使用相同的数据流进行更新...这是实时图块的限制,还是我遗漏了某些内容?
这是我正在尝试做的事情的一个片段......
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您对所有 3 个
StandardTileData
实例使用相同的isoStoreTileImage
变量。所以这意味着您将覆盖同一个图像。大胆猜测说您对所有 3 个图块使用相同的图像 URI,因此使用相同的数据更新它们;-)
You're using the same
isoStoreTileImage
variable for all 3StandardTileData
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 ;-)