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