Re: Saving the loaded files in MyDocuments

I have doubts about the silverlight application, access to MyDocuments. I am creating an application that will download a set of files from a remote server. Is it possible to save this file in MyDocuments instead of isolated storage. I am using Silverlight 4.0. Can anyone give me some sample code for it.

+3
source share
2 answers

To achieve what you need to use Silverlight 4 and to specify that during installation as the application other than the browser, you should receive elevated privileges. When working as an OOB, the application will have access to the User Documents folder.

SaveFileDialog, , .

: -

if (Application.Current.HasElevatedPermissions)
{
   string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
   path = Combine.Path(path, "MySaveFile.dat");
   using (var filestream = File.OpenWrite(path))
   {
        // pump your input stream in to the filestream using standard Stream methods
   }
}
+2

.

0

Source: https://habr.com/ru/post/1730856/


All Articles