Silverlight Feeds - All your Silverlight feeds in one place.

Sponsors

Tuesday, January 19, 2010

Silverlight 4 FileSystemWatcher ... no strings attached

by Michael Wolf via Michael Wolf on 1/19/2010 8:57:30 PM

In my last post I showed how to implement a bridge service using the new net.tcp binding in order to implement something not native to Silverlight 4, namely a FileSystemWatcher. While this works, as does Justin Angels com+ implementation (http://justinangel.net/#BlogPost=CuttingEdgeSilverlight4ComFeatures), it doesn't translate well to the mac, and eventually the mono , platform. However seeing Justin's com+ implementation inspired me to create a full Silverlight implementation using a background thread to look for changes. Overall this took around an hour.

In my ruff first pass implementation the file system watcher is a dependency object. Thus it can run its own background worker, and dispatch back to the UI thread to publish back events, without slowing down the ui thread looking for changes. It wakes up every 3 seconds to search the path looking for changed/deleted/ or additional files. With this "native Silverlight" implementation it is also restricted to the elevated trust System.IO file sandbox (folders: My Documents, My Pictures, My Videos , My Music and related subfolders see http://msdn.microsoft.com/en-us/library/ee721083(VS.96).aspx#file_system_access). Not as solid as having this functionality built directly into the framework, also does not give you the full os access like com and or a bridge service would. However it does give an option for building cross platform solutions which must monitor an accessible folder.

See the screencast below to see it in action.



email it!bookmark it!digg it!

Original Post: Silverlight 4 FileSystemWatcher ... no strings attached

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us