0

我为 Windows Phone 7/8 编写了一个应用程序。我希望我的默认图块看起来像 WP8 的图块,所以我以这种方式使用 Mangopollo:

var tile = new IconicTileData
{
      Title = "WP Day",
      Count = 8,
      BackgroundColor = Colors.Transparent,
      IconImage = new Uri("/ApplicationIcon.png", UriKind.Relative),
      SmallIconImage = new Uri("/ApplicationIcon.png", UriKind.Relative),
      WideContent1 = "WP Developer Day",
      WideContent2 = "use Windows Phone 8 features",
      WideContent3 = "on Windows Phone 7 apps"
}.ToShellTileData();;

var tile2 = new StandardTileData
{
    Title = "E",
    Count = 9
};

ShellTile.ActiveTiles.FirstOrDefault().Update(tile);

但它不影响。当我想用瓦片对象(IconicTileData)更新“第一个”瓦片时没有任何效果。但是当我使用tile2对象时,瓷砖正在更新。有任何想法吗?

我在一些应用程序中看到了这是可能的,例如 TinyDO。

4

1 回答 1

0

从链接修改后尝试了此代码:http ://wp.qmatteoq.com/tag/mangopollo/

它有效.. 正是这条线起到了作用:

Uri navigationUri = new Uri("/MainPage.xaml?Id=5", UriKind.Relative);
private void OnCreateWideTileClick(object sender, RoutedEventArgs e)
{
    if (true)
    {
        var tile = new IconicTileData
        {
            Title = "WP Day",
            Count = 8,
            BackgroundColor = Colors.Transparent,
            IconImage = new Uri("/Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative),
            SmallIconImage = new Uri("/Assets/Tiles/IconicTileSmall.png", UriKind.Relative),
            WideContent1 = "WP Developer Day",
            WideContent2 = "use Windows Phone 8 features",
            WideContent3 = "on Windows Phone 7 apps"
        }.ToShellTileData();

        ShellTileExt.Create(new Uri("/MainPage.xaml?Id=5", UriKind.Relative), tile, true);
    }
    else
    {
        MessageBox.Show("This is Windows Phone 7");
    }
}

private void OnUpdateTileClick(object sender, RoutedEventArgs e)
{
    if (Utils.IsWP8)
    {
        IconicTileData tile = new IconicTileData
        {
            WideContent1 = "This is the new content",
            WideContent2 = "The tile has been updated",
            WideContent3 = "with success"
        };

        Uri navigationUri = new Uri("/MainPage.xaml?Id=5", UriKind.Relative);
        ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri == navigationUri).Update(tile);
    }
}
于 2013-11-30T12:27:05.360 回答