保存在Silverlight应用程序中的图像文件夹PNG文件 [英] save png file in application image folder in silverlight

查看:226
本文介绍了保存在Silverlight应用程序中的图像文件夹PNG文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用silverlight.But保存PNG文件,我想将其保存在应用IMG folder.my code是如下:

i save a png file using silverlight.But i want to save it in application IMG folder.my code is as follows:

if (lastSnapshot != null)
        {
            string ImageName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString()
            + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".png"; 
            string filePath=System.IO.Path.Combine("~/Images/", "" + ImageName + "");  
            using (var pngStream = GetPngStream(lastSnapshot))
            using (var file = File.Create(filePath))
            {
                byte[] binaryData = new Byte[pngStream.Length];
                long bytesRead = pngStream.Read(binaryData, 0, (int)pngStream.Length);
                file.Write(binaryData, 0, (int)pngStream.Length);
                file.Flush();
                file.Close();
            }

        }

我想这样做在silverlight.can我做到这一点?我可以保存文件,直接在应用程序文件夹?hhow做it.anyone帮助我大大AP preciated.thanks提前。<一个href=\"http://stackoverflow.com/questions/13599599/save-png-file-in-application-image-folder-without-using-savedialogfile\">save在为png图像应用程序文件夹文件,而无需使用savedialogfile

推荐答案

您必须提供一个web服务,或者在服务器端上传网址,并使用从Silverlight中的客户端。

You will have to provide a webservice or upload url at the server side and use that from within Silverlight at the client.

Silverlight的应用程序不能直接访问该服务器中的文件夹,因为Silverlight的执行在客户端。

Silverlight applications to NOT have direct access the the server's folders because Silverlight executes at the client.

这篇关于保存在Silverlight应用程序中的图像文件夹PNG文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆