Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Silverlight - Saving a file without the dialog?

Silverlight - Saving a file without the dialog?

Scheduled Pinned Locked Moved WPF
question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dbrenth
    wrote on last edited by
    #1

    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

    M P 2 Replies Last reply
    0
    • D dbrenth

      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

      M Offline
      M Offline
      Michael J Eber
      wrote on last edited by
      #2

      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.

      M M 2 Replies Last reply
      0
      • M Michael J Eber

        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.

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M Michael J Eber

          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.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          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:

          1 Reply Last reply
          0
          • D dbrenth

            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

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            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

            D 1 Reply Last reply
            0
            • P Pete OHanlon

              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

              D Offline
              D Offline
              dbrenth
              wrote on last edited by
              #6

              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

              P 1 Reply Last reply
              0
              • D dbrenth

                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

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups