Aneesh
Aneesh

Reputation: 73

Updating WMAppManifest file dynamically

In my Windows Phone 8 application i want to access the WMAppManifest file.Also i want to update the Cyclic tile image path dynamically. How is it possible to updathe the Manifest file dynamically? Please help me.

Upvotes: 2

Views: 1199

Answers (3)

JustinAngel
JustinAngel

Reputation: 16102

In order to update your primary tile on WP7/WP8 you don't need to update your WmAppManfiest. Instead invokeShellTile.ActiveTiles.First().Update(myTileData) with tile data matching the type of the tile declated in WmApManfiest. ShellTile.ActiveTIles has all the app's tiles. The first tile in the ShellTile.ActiveTIles collection is always the app's primary tile and each subsequent tile is always a secondary tile.

You can update the tile by invoking Update on it with fresh data. Here's a great article covering how to set and update all new WP8 tiles (Flip, Iconic and Cyclic). @ http://codingchick.net/?p=17

The code sample in the article is pretty self-explanatory:

   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             }

And here's a code snippet example from the article initializing a 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                 };

Upvotes: 7

Martin Suchan
Martin Suchan

Reputation: 10620

You cannot modify your WMAppManifest programatically. You can only edit it in Visual Studio either using the visual editor, or directly by editing the XML.
In runtime you can access this file like any other in resources using this approach:
How to get a deep link of my application from the Windows Phone Marketplace using .NET code?

And for creating or updating existing or new tiles of your app in runtime use this guide:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx

Upvotes: 0

nkchandra
nkchandra

Reputation: 5557

Go to your Nuget package manager and search for "Manifest", you will get "Access to WPAppManigfest..." package, which gives access to the Manifest file.

Or else, in the package manager console, use this command to get this package.

PM> Install-Package WMAppManifest

Upvotes: 0

Related Questions