2013-12-11 191 views
0

我想将文档保存在保存箱中,我已将文档保存在设备上。以及从我的应用程序保存在保管箱中的UIImage。如何将图像或文件保存到保存箱中xamarin?

DBError error; 

     string ruta = Environment.GetFolderPath (Environment.SpecialFolder.Personal); 
     string rutaarchivo = Path.Combine(ruta,"Geodesia.xml"); 
     DBPath newPath = DBPath.Root.ChildPath(rutaarchivo); 
     DBFile archivo = DBFilesystem.SharedFilesystem.CreateFile (newPath,out error); 

我使用此代码,但只创建该文件,有人帮助我?

回答

0

根据Dropbox API Documentation,CreateFile只能打开文件。您需要使用WriteContentsOfFile将其他文件的内容复制到该文件中。

例如:

archivo.WriteContentsOfFile(rutaarchivo, false); 
+0

感谢您的帮助,我发现另一种方法我用图像archivo.WriteData(Image.AsPNG(),超时错误)的代码;这对于文件archivo.WriteData(rutaarchivo,out error);祝你今天愉快!! –