Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Lessons in building an uploader in Silverlight

I mentioned previously that I was working on a multi-file upload control for Silverlight. Yes, it has been done, but it's a good practical thing to get your head around. I feel like I've managed to get to a good place with it in terms of the "hard" parts (that is, getting to know Silverlight). I haven't fleshed out the back end part as much yet.

The biggest challenge of course for anyone who has spent most of their professional programming life doing Web-based stuff is understanding the right way to do threading. I've done the asynchronous handlers and even put objects on timers in Web apps, but dealing in a real, stateful UI is definitely a different animal. What makes things easier is Silverlight's BackgroundWorker class, which allows you to send notifications to the UI on its finish event. In addition, the Dispatcher helps keep your junk thread safe. That's critical since you can bind UI to pretty much anything with dependency properties, easily the most important concept in Silverlight (and WPF, for that matter). Pro Silverlight 2 in C# is absolutely awesome in that respect, where other books I've read (for SL and WPF) have failed.

The downside of this is that there is no image resizing, but I'm crossing my fingers that the FJCore guys will add a bicubic resizing filter to their library. .NET developers will finally be free of resorting to ActiveX controls and Java applets for this kind of work. I'm still very surprised that there wasn't some basic image manipulation baked into Silverlight, if not the core, then one of the add-on assemblies.

The long range goal is to use this with a plugin for POP Forums that basically does user uploaded photo galleries. Every day I can think of a new use for the forum infrastructure. It works with a wide range of community type things.

2 Comments

Comments have been disabled for this content.