Dec 26, 2010 at 5:00 PM
Edited Dec 26, 2010 at 5:08 PM
hello thanks for your concern.
I'm a freshmen in SilverLight and C#, i don't know Where i'm wrong . I am look to you for help.
i am trying to build a Windows phone 7 Solution, I wanna Save a WritableBitmap to a PNG file ( in isolated storage ), and use the Image Control to show the png file.
first, I add the reference:
ImageTools.Utils ImageTools.IO.Png ImageTools
second ,I add the namespace:
Third, I add the code :
I have got the WritableBitmap (myBitmap).
PngEncoder pngCoder = new PngEncoder();
MemoryStream pngStream = new MemoryStream();
myImage = myBitmap.ToImage();
// save to png file in Isolated storage file
var myStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream myFileStream = myStore.CreateFile("mystorage\test.PNG");
StreamWriter filewriter = new StreamWriter(myFileStream);
// Then read the Png file and show
IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication();
StreamReader fileReader = null;
fileReader = new StreamReader(new IsolatedStorageFileStream("mystorage\\test.PNG", FileMode.Open, fileStorage));
Stream pngSaveStream = fileReader.BaseStream;
PngDecoder pngDecoder = new PngDecoder();
ExtendedImage myImage = new ExtendedImage();
pngDecoder.Decode(myImage, pngStream); // there was always a Exception
WritableBitmap mybitmap2=myImage.ToBitmap(); //there was always a Exception
image1.Source = mybitmap2;
Can I Use it like this? I am so sorry, may be my question is too easy, I am studying to use SilverLight and C#.
and I don't know too much about XAML, I Used to program with C and C++.
Can you show me how should i use Imagetools. and I hope you can give me a simple example to use ImaeTools in windows Phone 7 (my Email:
I have seen the examples in Source Code Column , but I can't understand it , When I read through the Code , I still don't know How I
Can use ImageTools in my Solution.
Thank you for your attention. I am looking for your reply.