Windows phone 8 获取存储在isolatedstorage中的图像的URI
我已使用以下代码在isolatedstorage中保存了一个名为“logo.jpg”的文件Windows phone 8 获取存储在isolatedstorage中的图像的URI,windows-phone-8,live,tile,Windows Phone 8,Live,Tile,我已使用以下代码在isolatedstorage中保存了一个名为“logo.jpg”的文件 private void step2_Click(object sender, RoutedEventArgs e) { // Create a filename for JPEG file in isolated storage. String tempJPEG = "logo.jpg"; // Create vi
private void step2_Click(object sender, RoutedEventArgs e)
{
// Create a filename for JPEG file in isolated storage.
String tempJPEG = "logo.jpg";
// Create virtual store and file stream. Check for duplicate tempJPEG files.
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (myIsolatedStorage.FileExists(tempJPEG))
{
myIsolatedStorage.DeleteFile(tempJPEG);
}
IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);
try
{
WriteableBitmap wb = new WriteableBitmap(img);
// Encode WriteableBitmap object to a JPEG stream.
Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
}
catch { }
//wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
fileStream.Close();
}
NavigationService.Navigate(new Uri("/Stage2.xaml?num="+Contact_number.Text+"&name="+contact_name.Text, UriKind.Relative));
}
并使用此功能创建平铺
private StandardTileData GetSecondaryTileData()
{
string filePath = System.IO.Path.Combine(@"/Shared/ShellContent", "logo.jpg");
StandardTileData tileData = new StandardTileData
{
Title = name,
BackgroundImage = new Uri(@"isostore:" + filePath, UriKind.Absolute),
Count = 0,
BackTitle = "app",
BackBackgroundImage = new Uri("", UriKind.Absolute),
BackContent = "content"
};
但它抛出了一个例外
“System.ni.dll中发生'System.UriFormatException'类型的异常,但未在用户代码中处理
其他信息:无效URI:URI为空。“问题在于图像不在共享/shellcontent/中,并且
BackBackgroundImage = new Uri("", UriKind.Absolute),
这是不正确的。它应该是相对的,如果瓷砖必须保持空白。。。花了这么多小时。huff问题是图像不在共享/shellcontent/中,而且
BackBackgroundImage = new Uri("", UriKind.Absolute),
这是不正确的。它应该是相对的,如果瓷砖必须保持空白。。。花了这么多小时。哈夫用这个
MediaLibraryExtension.GetPath(p)代码>
这里p是类Picture的对象(即它将返回路径的图片)使用此
MediaLibraryExtension.GetPath(p)代码>
这里p是类Picture的对象(即它将返回路径的图片)刚刚使用isostorespy检查了我的isolatedstorage。映像位于isostorage的根目录中。不在共享内容中。现在怎么办?刚刚用isostorespy检查了我的隔离存储。映像位于isostorage的根目录中。不在共享内容中。现在该怎么办?