10th Day of Silverlight : O/S Integration

Time flies.  I took a week off for Christmas and the next thing I know it’s been a few weeks.  The good news is I’ve gotten a new project off of the ground and can’t wait to start talking about it.

So where were we?  That’s right, the 10th day.  I’ve received a lot of great feedback from folks and I wanted to thank everyone for all of the comments.

On the tenth day of Silverlight the team delivered to me… better O/S integration.

I touched on this subject back on day 1’s : Native Windows.  For me, the addition of native window support in Silverlight 5 was a big win.  However, the team did not stop there.  There are several more areas that the team focused on and I thought this would be a great post to talk about them.

Power Awareness

The first time I heard someone from the team present this feature, I have to admit, I didn’t really see the point.  However, that very night it became clear to me that this is a nice little feature to have.  Traditionally, Silverlight did not play a part in power management.  So if you had an application, say a video player, running but there was no real interaction taking place the computer might go into sleep mode.  Which, ironically, happened to me that evening when I was streaming some videos from the previous MIX conference.  Silverlight 5 now takes care of that for you.  If you happen to have a video playing, Silverlight won’t let your machine take a little nap.  That means you don’t have to worry about occasionally moving the mouse around to keep things awake.  The best thing about this feature is that it does not require any code to take advantage of it.


So raise your hands if you have used the Silverlight 4 COM interop.  Ok, now keep your hands up if you had fun doing it.  Where did all of the hands go?  COM interop was a very important addition to Silverlight 4.  It really opened the door to allow you to create applications that stepped outside of the sandbox and interacted with the system.  However, it did have one little flaw, COM. It’s like IE 6, just when you thought you had seen the last of it… I digress..

P/Invoke takes that interop access one step further.  Now you have more direct access to the Win32 API and you can pretty much do anything you need to on the system.  Of course, this is only available in elevated trust mode.  There are a lot of examples out on the web that go into this in more detail.  I would suggest strolling over to Pete Brown’s blog and take a look at his Enumerating Printers using P/Invoke  post to really get a feel for P/Invoke in action.

Unrestricted File System Access

Silverlight 5 opens up access to the file system, again in elevated trust mode, to your applications.  You are no longer constrained to certain paths for accessing files.

In thinking about this feature, I have to tell a little story.  Being a Silverlight MVP has been a lot of fun and one of the great things about it is the interaction you get to have with the product team.  This feature is one of the first times that I witnessed the team really listening to us non-blue badges (not that it was the first time, but simply the first time that I was able to be a part of it).  Someone from the team asked the group about the file system access and purposed to open up the access to more locations but not the entire system.  A few people responded with some use cases where full access might be better, and just like that, we have full access to the file system.  It has been really interesting to be involved in that process.

64-Bit Support

All I can say is “finally”.  Silverlight 5 now offers a 64-bit client.  My understanding is that this was no small task.  However, I am truly grateful that it is now available.  There is no longer a need to attempt to explain to folks why their 64-bit IE wouldn’t load your Silverlight applications. Whew…  Thank you Silverlight team…

Full Trust for In-Browser Mode

Full trust is no longer just for your out-of-browser applications.  You can now implement it in-browser.  This give you a leg up when having to install your applications is not the ideal solution.

Save Dialog Default Name

One last little nugget is you can now specify a default file name in the save file dialog.  Doing this is rather straight forward.  The SaveFileDialog has a new property, DefaultFileName.  I bet you can’t guess how to use this feature….

This gives you a little more control, or at a minimum suggestive power, on what a file is named when saving.

So lot’s of goodies in Silverlight 5 when talking about the O/S integration.  Make sure you take a look at them and take advantage of them in your next application.  Two more days left and we will bring this series to a close.  Don’t worry, you won’t have to wait a few weeks for the last two posts.

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

.NET development is constantly changing and expanding. With over 20 years in the industry, I have had the opportunity to see this the technology and the community grow and shift. To get weekly updates and insights into the world of .NET, development, and career advancement click the subscribe button.