当我将应用程序存储在Windows 10通用应用程序中时,平铺图像不显示

时间:2016-05-10 07:01:28

标签: c# windows-10 windows-10-universal windows-10-mobile

我使用下面的代码来固定磁贴,这里我使用TileNotificationsPack.dll来更新磁贴。

Uri Squarelogo = new Uri(ms-appx:///TileImages/150x150.jpg, UriKind.RelativeOrAbsolute);
Uri Widelogo = new Uri(ms-appx:///TileImages/310x150.jpg, UriKind.RelativeOrAbsolute);
Uri smalllogo = new Uri(ms-appx::///TileImages/30x30.jpg, UriKind.RelativeOrAbsolute);
SecondaryTile secondaryTile = new SecondaryTile(ShowId, title, ProjectName, tileActivationArguments, TileOptions.ShowNameOnLogo, Widelogo);
secondaryTile.ForegroundText = ForegroundText.Light;              
secondaryTile.WideLogo = Widelogo;
secondaryTile.Logo = Squarelogo;
secondaryTile.SmallLogo = smalllogo;
await secondaryTile.RequestCreateAsync();       

仅当我将应用程序存储在商店图块图像中时才显示调试模式中的平铺图像..

1 个答案:

答案 0 :(得分:1)

我使用下面这段代码,上次我为150x150.jpg和30x30.jpg使用了250x250尺寸的图像,现在我使用精确尺寸的图像,现在当应用程序在商店时,瓷砖正在工作..

Uri Squarelogo = new Uri(ms-appx:///TileImages/150x150.jpg, UriKind.RelativeOrAbsolute);
Uri smalllogo = new Uri(ms-appx::///TileImages/30x30.jpg, UriKind.RelativeOrAbsolute);
var tileActivationArguments = "MySecondaryTile Was Pinned At " + DateTime.Now.ToLocalTime().ToString();

SecondaryTile secondaryTile = new SecondaryTile(ShowId, title, tileActivationArguments, Squarelogo, TileSize.Square150x150);
secondaryTile.VisualElements.ForegroundText = ForegroundText.Light;
secondaryTile.VisualElements.Wide310x150Logo = Squarelogo;
secondaryTile.VisualElements.Square30x30Logo = smalllogo;
secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true;

await secondaryTile.RequestCreateAsync();