我正在开发一款Windows手机。已包含小型和中型手机。我想将宽幅瓷砖添加到其中。我怎么能这样做?
答案 0 :(得分:2)
您可以在wp7.8中包含大图块,如下所示:
public class CheckOSVersion
{
private static Version TargetedVersion;
public static bool IsTargetedVersion
{
get { return Environment.OSVersion.Version >= CheckOSVersion.TargetedVersion; }
}
static CheckOSVersion() { CheckOSVersion.TargetedVersion = new Version(7, 10, 8858); }
private static void SetProperty(object instance, string name, object value)
{
MethodInfo setMethod = instance.GetType().GetProperty(name).GetSetMethod();
object[] objArray = new object[1];
objArray[0] = value;
setMethod.Invoke(instance, objArray);
}
public static void UpdateFlipTile(string title, string backTitle, string backContent, string wideBackContent, int count, Uri tileId, Uri smallBackgroundImage, Uri backgroundImage, Uri backBackgroundImage, Uri wideBackgroundImage, Uri wideBackBackgroundImage)
{
try
{
if (CheckOSVersion.IsTargetedVersion)
{
Type type = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
Type type1 = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
foreach (ShellTile activeTile in ShellTile.ActiveTiles)
{
if (activeTile.NavigationUri.ToString() != tileId.ToString() && !activeTile.NavigationUri.ToString().Equals("/Login.xaml?flag=0"))
{
continue;
}
object obj = type.GetConstructor(new Type[0]).Invoke(null);
CheckOSVersion.SetProperty(obj, "Title", title);
CheckOSVersion.SetProperty(obj, "Count", count);
CheckOSVersion.SetProperty(obj, "BackTitle", backTitle);
CheckOSVersion.SetProperty(obj, "BackContent", backContent);
CheckOSVersion.SetProperty(obj, "SmallBackgroundImage", smallBackgroundImage);
CheckOSVersion.SetProperty(obj, "BackgroundImage", backgroundImage);
CheckOSVersion.SetProperty(obj, "BackBackgroundImage", backBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackgroundImage", wideBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackBackgroundImage", wideBackBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackContent", wideBackContent);
object[] objArray = new object[1];
objArray[0] = obj;
type1.GetMethod("Update").Invoke(activeTile, objArray);
//break;
}
}
}
catch { }
}
public static void CreateFlipTile(string title, string backTitle, string backContent, string wideBackContent, int count, Uri tileId, Uri smallBackgroundImage, Uri backgroundImage, Uri backBackgroundImage, Uri wideBackgroundImage, Uri wideBackBackgroundImage)
{
try
{
if (CheckOSVersion.IsTargetedVersion)
{
Type type = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
Type type1 = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
object obj = type.GetConstructor(new Type[0]).Invoke(null);
CheckOSVersion.SetProperty(obj, "Title", title);
CheckOSVersion.SetProperty(obj, "Count", count);
CheckOSVersion.SetProperty(obj, "BackTitle", backTitle);
CheckOSVersion.SetProperty(obj, "BackContent", backContent);
CheckOSVersion.SetProperty(obj, "SmallBackgroundImage", smallBackgroundImage);
CheckOSVersion.SetProperty(obj, "BackgroundImage", backgroundImage);
CheckOSVersion.SetProperty(obj, "BackBackgroundImage", backBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackgroundImage", wideBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackBackgroundImage", wideBackBackgroundImage);
CheckOSVersion.SetProperty(obj, "WideBackContent", wideBackContent);
object[] objArray = new object[1];
objArray[0] = obj;
MethodInfo createmethod = type1.GetMethod("Create", new[] { typeof(Uri), typeof(ShellTileData), typeof(bool) });
createmethod.Invoke(null, new object[] { tileId, obj, true });
}
}
catch { }
}
}
答案 1 :(得分:0)
Windows Phone OS 7.1和Windows Phone 8之间的主要区别 Tiles是Windows Phone OS 7.1只提供一个Tile模板。这个 模板称为TileTemplate5,并映射到翻转模板中 Windows Phone 8.TileTemplate5仅提供一种尺寸,即 在Windows Phone 8中映射到中等大小。
请查看link以获取更多信息
我认为您将在Windows Phone 8应用程序中添加Wide tile。请执行以下操作。
1.打开WMManifest.xml
文件
2.Tick Support for Large Tiles
3.为Large[Wide] Tile.