2
我目前正在开发一个项目,用户需要从那里从照片库中选择图片并导入它。使用下面的代码我可以导入图片,但我有几个问题。导入图片并保存到独立存储WP7
- 什么是导入时命名的图像?
- 哪里是位于图像导入一次
- 是否有可能保存图像,并重新加载它,当应用程序被再次打开(即使用独立存储)
继承人的代码从一个教程
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System.IO;
using System.Windows.Media.Imaging;
namespace PhoneApp4
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
PhotoChooserTask selectphoto = null;
private void button1_Click(object sender, RoutedEventArgs e)
{
selectphoto = new PhotoChooserTask();
selectphoto.Completed += new EventHandler<PhotoResult>(selectphoto_Completed);
selectphoto.Show();
}
void selectphoto_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
BinaryReader reader = new BinaryReader(e.ChosenPhoto);
image1.Source = new BitmapImage(new Uri(e.OriginalFileName));
}
}
}
}
如何访问该文件名?而且我将如何去存储它?你碰巧有一个教程或参考你会建议? – Al3xhamilton
我添加了一些代码。 –
好的抱歉提出更多问题,但我如何访问文件名,如果我把SaveImage代码放在onexit类下,它会保存吗?非常感谢 – Al3xhamilton