Due to my lack of programming experience (3 months), I was not able to recreate any found examples of the above question. The examples I found relate to non-WP7 Silverlight camera-based image preservation, were difficult for my needs or just didn't work. I was able to download a text file using a Webclient instance and save it in isolated storage using StreamWriter. I need to perform one task with jpg images. Below I have uploaded a text file.
==================================================== ===============================
IsolatedStorageFile MyStore = IsolatedStorageFile.GetUserStoreForApplication();
private void GetTextFile()
{
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(new Uri("http://mywebsite.com/textfile.txt"));
}
private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
StreamWriter MyStreamWriter = new StreamWriter(new IsolatedStorageFileStream("textfile.txt", FileMode.Create, MyStore));
MyStreamWriter.WriteLine(e.result)
MyStreamWriter.Close();
}
==================================================== ===============================
I deleted a few lines used for error handling, etc., to make it as simple as possible.
, - , jpg?
, , .
!
! ============================================= ==================================
, .
http://dotnet.dzone.com/articles/operating-image-files-windows
, !
IsolatedStorageFile MyStore = IsolatedStorageFile.GetUserStoreForApplication();
private void GetImageFile()
{
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.OpenReadAsync(new Uri("http://mywebsite.com/1.jpg"), client);
}
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
var resInfo = new StreamResourceInfo(e.Result, null);
var reader = new StreamReader(resInfo.Stream);
byte[] contents;
using (BinaryReader bReader = new BinaryReader(reader.BaseStream))
{
contents = bReader.ReadBytes((int)reader.BaseStream.Length);
}
IsolatedStorageFileStream stream = MyStore.CreateFile("10.jpg");
stream.Write(contents, 0, contents.Length);
stream.Close();
}