2012-12-19 60 views

回答

7

由於XNA僅支持WP7應用程序,因此您必須檢查您的應用程序是否在WP8上運行,如果有,請使用反射將貼圖更新爲WP8圖標。還有的是代碼段會怎樣看這樣的MSDN文章在@Adding Windows Phone 8 Tile functionality to Windows Phone OS 7.1 apps

可能更容易在您使用Mangopollo庫,它有能力內建有相似的API到WP8的一個很好的例子。下面是包裝了WP8的API從WP7叫@http://mangopollo.codeplex.com/SourceControl/changeset/view/100687#2023247

源代碼,而這裏的Mangopollo代碼片段在WP7應用程序使用WP8廣瓷磚:

if (!Utils.CanUseLiveTiles) 
{ 
    MessageBox.Show("This feature needs Windows Phone 8"); 
    return; 
} 

try 
{ 
    var mytile = new FlipTileData 
    { 
     Title = "wide flip tile", 
     BackTitle = "created by", 
     BackContent = "Rudy Huyn", 
     Count = 9, 
     SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative), 
     BackgroundImage = new Uri("/Assets/Background336x336_1.png", UriKind.Relative), 
     BackBackgroundImage = new Uri("/Assets/Background336x336_2.png", UriKind.Relative), 
     WideBackContent = "This is a very long long text to demonstrate the back content of a wide flip tile", 
     WideBackgroundImage = new Uri("/Assets/Background691x336_1.png", UriKind.Relative), 
     WideBackBackgroundImage = new Uri("/Assets/Background691x336_2.png", UriKind.Relative) 
    }; 

#if ALTERNATIVE_SOLUTION 
    var mytile = Mangopollo.Tiles.TilesCreator.CreateFlipTile("flip tile", 
    "created by", "Rudy Huyn", 
    "This is a very long long text to demonstrate the back content of a wide flip tile", 
    9, new Uri("/Assets/logo159x159.png", UriKind.Relative), 
    new Uri("/Assets/Background336x336_1.png", UriKind.Relative), 
    new Uri("/Assets/Background336x336_2.png", UriKind.Relative), 
    new Uri("/Assets/Background691x336_1.png", UriKind.Relative), 
    new Uri("/Assets/Background691x336_2.png", UriKind.Relative)); 
#endif 
    ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20wipe%20flip%20tile", 
     UriKind.Relative), mytile, true); 
} 
catch 
{ 
    MessageBox.Show("remove tile before create it again"); 
} 

還有一點要記住的是,其他即使XNA應用程序是WP7應用程序,WP8 API也可以直接從XNA使用。這裏有一個關於如何use WP8 in-app purhcase on WP7 apps(包括XNA)的例子。這裏有一個例子how to use new WP8 Launchers & Choosers in WP7 apps(向下滾動)。

+0

上述Mangopollo示例應用程序代碼片段的最後一條語句使用MainPage.xaml的Uri來啓動應用程序。什麼Uri應該用於XNA遊戲? –