在我的Windows Phone 8应用程序中,我想访问WMAppManifest文件。我还想动态更新循环切片图像路径。如何动态更新Manifest文件?请帮帮我。
答案 0 :(得分:7)
要在WP7 / WP8上更新主要磁贴,您无需更新WmAppManfiest。而是使用与WmApManfiest中分解的切片类型匹配的切片数据来调用ShellTile.ActiveTiles.First().Update(myTileData)
。 ShellTile.ActiveTIles包含所有应用的磁贴。 ShellTile.ActiveTIles集合中的第一个图块始终是应用程序的主图块,每个后续图块始终是辅助图块。
您可以通过使用新数据调用更新来更新磁贴。这是一个great article,涵盖了如何设置和更新所有新的WP8磁贴(Flip,Iconic和Cyclic)。 @ http://codingchick.net/?p=17
文章中的代码示例非常明显:
27 // Select the application tile
28 ShellTile myTile = ShellTile.ActiveTiles.First();
29 if (myTile != null)
30 {
31 // Create a new data to update my tile with
32 FlipTileData newTileData = new FlipTileData
33 {
34 Title = “New Title”,
35 BackgroundImage = new Uri(@”Assets\Tiles\ChangedTileMedium.png”, UriKind.Relative),
36 BackTitle = “New Background Image”,
37 BackBackgroundImage = new Uri(textBoxBackBackgroundImage.Text, UriKind.Relative),
38 BackContent = “New Back Content”
39 };
40 // Update the application Tile
41 myTile.Update(newTileData);
42 }
以下是初始化CycleTileData的文章中的代码片段示例:
30 var cycleImages = new List<Uri>() { new Uri(@"Assets\Tiles\FlipCycleTileMedium.png", UriKind.Relative),
31 new Uri(@”Assets\Tiles\CustomTileLarge.png”, UriKind.Relative) };
32
33 CycleTileData newTileData = new CycleTileData
34 {
35 Title = “New Title”,
36 CycleImages = cycleImages,
37 Count = 5
38 };
答案 1 :(得分:0)
转到您的Nuget包管理器并搜索“Manifest”,您将获得“访问WPAppManigfest ...”包,可以访问Manifest文件。
否则,在包管理器控制台中,使用此命令获取此包。
PM> Install-Package WMAppManifest
答案 2 :(得分:0)
您无法以编程方式修改WMAppManifest。您只能使用可视化编辑器在Visual Studio中编辑它,或者直接通过编辑XML来编辑它
在运行时,您可以使用此方法像资源中的任何其他文件一样访问此文件:
How to get a deep link of my application from the Windows Phone Marketplace using .NET code?
要在运行时创建或更新应用的现有或新瓷砖,请使用本指南:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx