Silverlight - Saving a file without the dialog?
-
I have a silverlight app where the user can download the image to whereever he wants. Works fine, but now I need to save a "world file" with the image. It should be the same file name in the same path, just a different extension. However, I am unable to change the "SafeFileName" or get the path and location of the previously saved image file. I would even be willing to open a second SaveFileDialog, but I can't initialize the name of the file - or force the path. Is there any hope here? Thanks
Brent
-
I have a silverlight app where the user can download the image to whereever he wants. Works fine, but now I need to save a "world file" with the image. It should be the same file name in the same path, just a different extension. However, I am unable to change the "SafeFileName" or get the path and location of the previously saved image file. I would even be willing to open a second SaveFileDialog, but I can't initialize the name of the file - or force the path. Is there any hope here? Thanks
Brent
Yup, you cannot change the SaveFileName property in the dialog. You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
-
Yup, you cannot change the SaveFileName property in the dialog. You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
Michael J. Eber wrote:
and save the file manually using System.IO.File.
I didn't think that was possible in SL.
Never underestimate the power of human stupidity RAH
-
Yup, you cannot change the SaveFileName property in the dialog. You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
Michael J. Eber wrote:
You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
Not possible except maybe for out-of-browser apps with elevated trust...
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I have a silverlight app where the user can download the image to whereever he wants. Works fine, but now I need to save a "world file" with the image. It should be the same file name in the same path, just a different extension. However, I am unable to change the "SafeFileName" or get the path and location of the previously saved image file. I would even be willing to open a second SaveFileDialog, but I can't initialize the name of the file - or force the path. Is there any hope here? Thanks
Brent
The only real way to do this is to step outside Silverlight altogether, and use JavaScript to perform the downloads. There's a good explanation on how to do this here[^].
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
The only real way to do this is to step outside Silverlight altogether, and use JavaScript to perform the downloads. There's a good explanation on how to do this here[^].
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Thanks, After further searching I also found code to put all the files into one zip file. I don't think it works on all platforms (Macs for example), though. http://slsharpziplib.codeplex.com/[^]
Brent
I initially considered the zip file solution, but decided against it because it adds an extra step for the end user having to unzip the files.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility