I'm currently trying to determine the available disk space from my Silverlight application.
My app can download a lot of data (video files) and obviously, this can fail if the disk space isn't there. I know I can catch exceptions on writes, but that will not lead to a very user-friendly experience, because the information will come too late and cause useless waits.
In regular .NET, I would be using DriveInfo
(see How do I retrieve disk information in C#? for an example), but that class isn't present as of Silverlight 5, even in elevated trust mode.
So, is there a way to determine the available space on a drive in Silverlight?
Update:
- I'm fine with requiring Elevated Priviledges for my application.
- I'm also fine with Silverlight 5 only solutions.
- I need something that works on both Windows and Mac OS, so PInvoke/COM interop is not an option.