我正在尝试在 Windows Phone 开始屏幕上创建磁贴。以下代码曾经可以工作,但现在不行了。我没有改变任何东西。
private async static void CreateTile()
{
try
{
SecondaryTile tileData = new SecondaryTile()
{
TileId = "MyTileID",
DisplayName = "My App Name",
TileOptions = TileOptions.ShowNameOnLogo,
};
tileData.VisualElements.Square150x150Logo = new Uri("ms-appx:///Resources/Images/Tiles/150150.png", UriKind.Absolute);
tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
await tileData.RequestCreateAsync();
}
catch (Exception ex)
{
}
}
现在它失败并显示错误消息:
The parameter is incorrect.
和以下堆栈跟踪:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at My.Namespace.SplashPage.<CreateTile>d__f.MoveNext()
当我将所有内容注释掉时,我什至会收到错误消息,例如:
SecondaryTile tileData = new SecondaryTile()
{
//TileId = "MyTileID",
//DisplayName = "My App Name",
//TileOptions = TileOptions.ShowNameOnLogo,
};
//tileData.VisualElements.Square150x150Logo = new Uri("ms-appx:///Resources/Images/Tiles/150150.png", UriKind.Absolute);
//tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
await tileData.RequestCreateAsync();
所以我不知道哪个参数不正确。这可能是什么原因造成的?我该如何解决?