Chapter 16. Working with File I/O

WHAT'S IN THIS CHAPTER?

  • Working with the OpenFileDialog and SaveFileDialog classes

  • Examining the class available for file and directory access

  • Silverlight and file access

  • Moving, copying, and deleting files

Invariably, most applications built deal with files in some fashion. It might be that your application needs to simply work from an XML configuration file or even store the end users' settings or data on a file on their machines. For this reason, this chapter looks at working with files in your Silverlight applications as well as other means to store content on the client's computer.

You have a couple of different means to work with files and folders with your Silverlight applications. Silverlight does supply file dialogs that allow you to get the end user to specify the actual file that your application is to work with. But, with Silverlight 4, you also have to get programmatic access to specific folders on the end user's system through the Environment.SpecialFolders object when running your Silverlight 4 application in an out-of-browser mode with elevated permissions.

THE OPENFILEDIALOG AND SAVEFILEDIALOG CLASSES

In working with files, one of the easiest means has been around even prior to Silverlight 4. Using the OpenFileDialog and SaveFileDialog classes has allowed you to work with files directly on the end user's desktop. However, working with files in this manner did include some overall limitations that caused Microsoft to further expand upon ...

Get Professional Silverlight® 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.