C# 在尝试使用Windows Phone ShellTile API创建多个live Tile时,如何避免出现错误?

C# 在尝试使用Windows Phone ShellTile API创建多个live Tile时,如何避免出现错误?,c#,windows-phone-7,code-behind,live-tile,C#,Windows Phone 7,Code Behind,Live Tile,从这个示例开始,我创建了一个应用程序,将多个磁贴固定到开始屏幕。当我固定第一个磁贴时,我没有任何问题。但是,当我返回应用程序(通过应用程序列表或返回键)并单击第二个图像以固定第二个磁贴时,我会收到一个InvalidOperationException 以下是我的简单代码: private void Pin_Tile1(object sender, RoutedEventArgs e) { StandardTileData data1 = new StandardT

从这个示例开始,我创建了一个应用程序,将多个磁贴固定到开始屏幕。当我固定第一个磁贴时,我没有任何问题。但是,当我返回应用程序(通过应用程序列表或返回键)并单击第二个图像以固定第二个磁贴时,我会收到一个InvalidOperationException

以下是我的简单代码:

    private void Pin_Tile1(object sender, RoutedEventArgs e)
    {
        StandardTileData data1 = new StandardTileData
        {
            BackgroundImage = new Uri("Assets/tile1.png", UriKind.Relative),
            Title = "Tile 1",
            BackContent = "asdf"
        };

        ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), data1);
    }

    private void Pin_Tile2(object sender, RoutedEventArgs e)
    {
        StandardTileData data20 = new StandardTileData
        {
            BackgroundImage = new Uri("Assets/tile2.png", UriKind.Relative),
            Title = "Tile 2",
            BackContent = "fdsa"
        };
        ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), data2); 

    }
谁能告诉我发生了什么事?感谢您从中查找,每个活动互动程序都必须指向一个唯一的Uri,这就是我搞砸的地方

全部要求清单如下:

  • 每个活动磁贴必须指向唯一的URI位置
  • 每次创建辅助磁贴时,用户都将被带到 他们的主屏幕可以查看它。不能创建多个 一次使用二次瓷砖
  • 限制允许的辅助活动磁贴的数量

哈哈,我搞砸了。现已修复:)您从何处获得错误,瓷砖代码看起来正常。