Windows Phone 8.1 Silverlight Secondary Tile isostore 错误
Windows Phone 8.1 Silverlight Secondary Tile isostore error
我正在尝试将 UserControl 呈现为图像,然后将其分配给辅助磁贴并将其固定。生成的 URI 是
isostore:/Shared/ShellContent/CustomTile.jpg
但是,我收到以下错误:
ExceptionObject = {System.ArgumentException:值不在预期范围内。
在
Windows.UI.StartScreen.SecondaryTileVisualElements.put_Square150x150Logo(Uri 值)
在 NestWP.ActionTiles.d__1.MoveNext()
我有这段代码
var customTile = new ActionTileControl();
customTile.Measure(new Size(150, 150));
customTile.Arrange(new Rect(0, 0, 150, 150));
var bmp = new WriteableBitmap(150, 150);
bmp.Render(customTile, null);
bmp.Invalidate();
const string filename = "/Shared/ShellContent/CustomTile.jpg";
using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!isf.DirectoryExists("/CustomLiveTiles"))
{
isf.CreateDirectory("/CustomLiveTiles");
}
using (var stream = isf.OpenFile(filename, System.IO.FileMode.OpenOrCreate))
{
bmp.SaveJpeg(stream, 336, 366, 0, 100);
stream.Close();
}
bool ex = isf.FileExists(filename);
ex = ex;
}
string urilink = "isostore:" + filename;
SecondaryTile secondaryTile = new SecondaryTile()
{
TileId = "tileid",
DisplayName = "title",
Arguments = "args"
};
//Error on the line below
secondaryTile.VisualElements.Square150x150Logo = new Uri(urilink, UriKind.Absolute);
secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = false;
bool isPinned = await secondaryTile.RequestCreateAsync();
我检查了 FileExists 和 bool returns true。
如何将图像设置为辅助图块?
我正在尝试将 UserControl 呈现为图像,然后将其分配给辅助磁贴并将其固定。生成的 URI 是
isostore:/Shared/ShellContent/CustomTile.jpg
但是,我收到以下错误: ExceptionObject = {System.ArgumentException:值不在预期范围内。 在 Windows.UI.StartScreen.SecondaryTileVisualElements.put_Square150x150Logo(Uri 值) 在 NestWP.ActionTiles.d__1.MoveNext()
我有这段代码
var customTile = new ActionTileControl();
customTile.Measure(new Size(150, 150));
customTile.Arrange(new Rect(0, 0, 150, 150));
var bmp = new WriteableBitmap(150, 150);
bmp.Render(customTile, null);
bmp.Invalidate();
const string filename = "/Shared/ShellContent/CustomTile.jpg";
using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!isf.DirectoryExists("/CustomLiveTiles"))
{
isf.CreateDirectory("/CustomLiveTiles");
}
using (var stream = isf.OpenFile(filename, System.IO.FileMode.OpenOrCreate))
{
bmp.SaveJpeg(stream, 336, 366, 0, 100);
stream.Close();
}
bool ex = isf.FileExists(filename);
ex = ex;
}
string urilink = "isostore:" + filename;
SecondaryTile secondaryTile = new SecondaryTile()
{
TileId = "tileid",
DisplayName = "title",
Arguments = "args"
};
//Error on the line below
secondaryTile.VisualElements.Square150x150Logo = new Uri(urilink, UriKind.Absolute);
secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = false;
bool isPinned = await secondaryTile.RequestCreateAsync();
我检查了 FileExists 和 bool returns true。
如何将图像设置为辅助图块?