7.8 SDK finally out (download: http://www.cnblogs.com/sun8134/archive/2013/01/23/2872562.html)
Unfortunately, a single API has...
The only increase is the change of tile.
For more information, see the msdn documentation: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj720574 (V = vs.105). aspx
Supported features
A Windows Phone OS 7.1 app that runs on Windows Phone 8 or Windows Phone 7.8 supports the following tile features:
For the default tile, the flip tile is the only supported template. For more information about this template, see flip tile template for Windows Phone 8.
For secondary tiles, all tile templates are supported: Flip tile template for Windows Phone 8, iconic tile template for Windows Phone 8, and cycle tile template for Windows Phone 8.
Independently update the Small and Medium tile sizes. You can also optionally support the wide tile size.
You can use both push notifications and the shelltile APIs to update tiles.
The default tile only supports flip tile. Let's take a look at the implementation effect:
First of all to see the structure of flip tile, or see the msdn documentation: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206971 (V = vs.105). aspx
The image size is 159*159,336*336,691*336 * respectively.
There is also a 173*173 corresponding to wp7.5
Then start code. In the first step, determine whether the version is 7.8.
// Set the version
private static Version TargetedVersion = new Version(7, 10, 8858);
// Determine whether the version meets the requirements
public static bool isTargetedVersion { get { return Environment.OSVersion.Version >= TargetedVersion; } }
If it is about 7.8, replace the default tile with flip tile:
ShellTile appTile = ShellTile.ActiveTiles.First();
// Get the new FlipTileData type.
Type flipTileDataType = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
// Get the ShellTile type so we can call the new version of "Update" that takes the new Tile templates.
Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
// Loop through any existing Tiles that are pinned to Start.
//var tileToUpdate = ShellTile.ActiveTiles.First();
// Get the constructor for the new FlipTileData class and assign it to our variable to hold the Tile properties.
var UpdateTileData = flipTileDataType.GetConstructor(new Type[] { }).Invoke(null);
// Set the properties.
SetProperty(UpdateTileData, "Title", "Main Tile Title");
SetProperty(UpdateTileData, "Count", 0);
SetProperty(UpdateTileData, "BackTitle", "Back Tile Title");
SetProperty(UpdateTileData, "BackContent", "Content For back tile.");
SetProperty(UpdateTileData, "SmallBackgroundImage", new Uri("Windows 8 59.png", UriKind.Relative));
SetProperty(UpdateTileData, "BackgroundImage", new Uri("Windows 8 336.png", UriKind.Relative));
SetProperty(UpdateTileData, "BackBackgroundImage", new Uri("", UriKind.Relative));
SetProperty(UpdateTileData, "WideBackgroundImage", new Uri("Windows 8 691.png", UriKind.Relative));
SetProperty(UpdateTileData, "WideBackBackgroundImage", new Uri("", UriKind.Relative));
SetProperty(UpdateTileData, "WideBackContent", "Content for Wide Back Tile. Lots more text here.");
// Invoke the new version of ShellTile.Update.
shellTileType.GetMethod("Update").Invoke(appTile, new Object[] { UpdateTileData });
How to set the flip tile attribute:
private static void SetProperty(object instance, string name, object value)
{
var setMethod = instance.GetType().GetProperty(name).GetSetMethod();
setMethod.Invoke(instance, new object[] { value });
}
In addition, in the msdn document (http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj720574 (V = vs.105). aspx), you must modify wmappmanifest. XML to add the appextra node:
In addition, it indicates that an error will be reported in vs2010 after being added. Only vs2012 can be used smoothly. If it is used in vs2010, compile and generate xap, and then decompress wmappmanifest. XML, modified and re-packaged...
But this instruction was removed from the Chinese msdn document (http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/jj720574 (V = vs.105). aspx)
In addition, I tested the code in vs2010 and did not add any difference... Is it a requirement for Beta?
Finally, let's look at the effect:
Source code:
Refer:
Http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/jj720574 (V = vs.105). aspx
Http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj720574 (V = vs.105). aspx
Http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206971 (V = vs.105). aspx
Http://blogs.msdn.com/ B /lmoroney/archive/2013/01/28/create-a-windows-phone-7-flip-tile-and-update-it-to-windows-phone-8-style-using-the-windows-phone-7-8-sdk.aspx