This Quick Tip was stolen for DevFish’s TackleBox app. I wanted to put some configuration data into my application to be picked up at runtime. For this approach Isolated Storage didn’t make a lot of sense. This data was stored as a simple text file, but it could be an XML document, JSON or even and image. I just needed to get my hands on the content of the files and do something with it. After fixing the bugs in Joe’s code, I found you can access these files with the following code snippet:
Where the file name that is passed in will be the full name of the file. In our case we would pass in something like Manifest.txt.
One very important note: Even though you are calling Application.GetResourceStream, you MUST specify that your content type is of type Content. This will make sure the file gets packaged up and included with your XAP and not compiled into your binary.
Post a Comment