| Comments

Today’s the day!  Tuesday at DevConnections in Las Vegas, Scott Guthrie just announced the ‘launch’ of Silverlight 4.  We wanted to take the opportunity at DevConnections to let a large audience of our customers online/offline know that we’re done and shipped Silverlight 4.  As of today it’s now available for you to download/use.  Here’s some helpful quick update information for you:

What’s New in Silverlight 4?

Rather than cut/paste what I’ve already said here, I recommend the following reading:

These two posts are full of detailed information with links to tutorials and videos to help you get started.  Since the RC (which was released middle March), not much has changed from an API perspective so you should be good to go getting started using the above information.  One thing that has changed in the tools is that for XAP signing, there is a UI support for enabling the tool to help you select a certificate, etc.  You can still use my post-build method though.

Downloading Silverlight 4

The availability of Silverlight 4 will be approximately 10:00 AM PST on Thursday 15 April 2010.  I suggest you prep now by getting the Visual Studio 2010 release that was launched/available yesterday.

The goods:

That’s my own personal minimum list.  VS and SL4 tools are the minimum required to get started doing development.

Wait, what’s this RC stuff?

To be clear, Silverlight 4 has released.  This is RTW (release to web).  It is the version 4 of Silverlight.  Shipped.  Done.  Finished.

The tools (namely SL4 tools, RIA Services and Blend) are in their ‘release candidate’ mode.  I’ll spare you the gory details, but remember that these tools teams need SL4 to be *done* before they can be done.  SL4 is a dependency for them.  These tools are release quality though and I’d recommend using them.  Their final versions will come soon enough and will be a minor update.

What about RIA Services?!  You don’t consider that to be valuable?!

Actually I do.  But if you’ve installed the Silverlight 4 Tools, then you already have it!

This seems to be some confusion to many and perhaps because of how we present the information in an effort to be complete.  If you are a developer, install Silverlight 4 Tools.  After this installation completes you will have:

  • Silverlight 4 developer runtime
  • Silverlight 4 SDK
  • Visual Studio patch, debug tools and project templates
  • WCF RIA Services RC

installed.  No need to run the SDK or RIA Services installers separately.  Adding the Silverlight Toolkit to this provides you with more controls to leverage in your applications as well (charting, ContextMenu, etc.).

Hey, what about the Windows Phone 7 developer tools?

If you need to continue doing Windows Phone 7 development, stick with the Visual Studio 2010 Release Candidate for now!  The updated CTP of the Windows Phone developer tools is not quite done yet.  Information about updated tools availability will be forthcoming on these tools.  Stay tuned.

Can I keep VS2008 and VS2010 on the same machine?

Yes you can.  Visual Studio 2008 and 2010 can co-exist on the same machine.  Obviously there are some differences to what the tools can do with regard to Silverlight.  There are two distinct differences I like to call out:

  • VS2008 cannot be used for Silverlight 4 development.
  • You can only have one version of WCF RIA Services installed on the machine.

For the latter, you may be asking “huh?”  There is a version of RIA Services for VS2008.  There is also a version for VS2010.  Unfortunately RIA Services cannot co-exist in two versions.  You have to pick one.  And the VS2008 one is only for SL3 and only supported until December this year.  I recommend moving on from that…it’s not going to be developed any more…essentially the PDC09 version was the last revision there.

Other resources

If you need other resources, be sure to check the Silverlight Community Site for details on things like the stand-alone documentation file, Mac platform developer build (for debugging if needed) and other resources.  Be sure to check out the Silverlight 4 videos if you haven’t yet as well!  I’ve gotten a few questions so I’ll emit some resources here:

Hope this helps find things easier.

What about the future versions…

Man, give us a break!!!  But seriously make your opinion known on http://silverlight.mswish.net for features.  Be specifically broad ;-).  What I mean is “Fix Printing” doesn’t help, but “Enable automatic paging in printing” is better.

Hope this helps!

| Comments

I recently got an inquiry to my Microsoft Translator sample on if this would work with the Silverlight in the Windows Phone 7 SDK.  I hadn’t tried it before, so I created a sample Windows Phone 7 application and copied the code over.  I used a basic UI to mock up the similarities:

Translator phone sample screenshot

And then clicked the button.  The text translated fine, but no audio.  I didn’t get any warnings that the WaveMSS code sample I was using wouldn’t work.  Then I remembered about XNA.

NOTE: I actually think this is a bug in PCM audio and MediaStreamSource and have been having a dialog with the team about it.

In Windows Phone 7 your Silverlight applications can use some XNA Game Framework APIs.  A big component of games is audio!  Enter SoundEffect.  I added a reference to Microsoft.Xna.Frameowkr and changed my OnSpeakCompleted from:

   1: void OnSpeakCompleted(object sender, TimHeuer.Silverlight.SpeakCompletedEventArgs e)
   2: {
   3:     WaveMSS.WaveMediaStreamSource mss = new WaveMSS.WaveMediaStreamSource(e.AudioTranslation);
   4:     PlayMe.SetSource(mss);
   5: }


   1: void OnSpeakCompleted(object sender, TimHeuer.Silverlight.SpeakCompletedEventArgs e)
   2: {
   3:     SoundEffect se = SoundEffect.FromStream(e.AudioTranslation);
   4:     se.Play();
   5: }

Notice it is still 2 lines of code :-).  I don’t need a MediaElement for the audio palyback because I can use the same libraries that XNA uses for audio (and in some instances this will be better for you for looping audio, etc.).

Very cool that Silverlight and XNA can share some libraries in a single application!

| Comments

Well, MIX10 is over.  It was a great time to meet a lot of people and see friends from afar.  As anyone knows, the networking is a HUGE part of being in-person at any conference…that vibe, value and friendship cannot be matched online.

But the sessions – there were a TON of them.  It is quite impossible to be in 3 places at one time.  Thankfully the MIX team record all regular sessions and make them available for viewing online or offline.  For you Silverlight developers here are my picks to ensure you watch:

And there are many more…

Since OData was a big part of MIX10 this year, I thought I’d make this easier for you to get all the MIX10 Silverlight-specific videos (my pics above and all tagged with Silverlight). 

Yes, this is yet another way to get access to the MIX videos.

The site’s RSS feed will get you *all* of MIX sessions, but you may not want that.  Unfortunately they don’t expose tag-specific RSS feeds.  Fortunately though, they DO have an OData feed available for us.  I thought I’d have some fun and play around with that.

MIX10 Online Silverlight Viewer

If I were the visitmix.com team – I’m sure they love to hear that.  But look at the list above.  If you watched each one of these, you’d be clicking a lot and going from page to page.  Why not treat them like a video library?  Let me see the ‘guide’ in one place and choose which ‘channel’ I want to watch, allowing me to switch channels quickly.  This was my vision:

MIX10 Session Viewer

Since their OData feed was exposed I could create queries to get to the list of sessions, details and video URIs.  I could (and would like) to do a lot more as far as adding a filter by tags, creating a playlist and then just hitting play, etc.  But you know, I was just tinkering.

I will have to say that the OData querying got me frazzled in some places.  OData is SUPER easy for single entity stuff, but trying to understand building up a relational query got me messed up at times since ‘normal’ LINQ querying wasn’t always supported in a translation to a URI query.  Special thanks to Jonathan Carter (@lostintangent) and Chris Woodruff (@cwoodruff) for being my ears of frustration and helping me get the right queries (didn’t end up implementing them all).

The sample MIX Viewer can be seen here and supports multi-monitor full-screen pinning (requires Silverlight 4).  So you can start a video on your 2nd monitor and go to full-screen on that one while still working on the other.

Tag-specific podcast feeds for MIX10 videos

While the MIX team does have RSS feeds for the videos, they are all-inclusive.  I would really like to have tag-specific feeds…let me search on a tag, then generate a podcast feed based on the result. 

Well, I did just that.  Since they expose the feed, I could use Yahoo Pipes to do some quick manipulation in a ‘no-code’ sort of way (yes I could have used OData, etc. blah blah – look, this was no-code/tools…just a few clicks).

So I created a podcast feed for anyone who wants to use it.  Here’s the Silverlight feed links you can use to paste into your iTunes or Zune or whatever podcast software:

If you look at the URI:

   1: http://pipes.yahoo.com/pipes/pipe.run?MediaType=WMV&Tag=Silverlight&_id=2cf69ebc6e9c4f0a1ea4bc76cfd273df&_render=rss

You’ll notice that you can just substitute the format (WMV, WMVHigh, or MP4) and the tag.  This will give you your own custom feed for your topic.

Anyhow, I really enjoyed MIX and have been catching up on all the sessions I missed.  Hope this helps you get caught up as well!

This work is licensed under a Creative Commons Attribution By license.

| Comments

If you’ve been excited about Windows Phone 7 development and the platform being Silverlight for application development, you probably rushed and downloaded all the tools (which are free by the way).  You may have even got the samples from the SDK and noticed the Location services example…but wondered why it doesn’t work.

If you are just getting started, I created some quickstart videos to help you through some of the basics.  You can view them here.

In case you haven’t figured it out: Location services (aka, GPS) is not emulated in the developer tools CTP. 

As you might expect, this makes it difficult to play around with location-based applications.

The API in Windows Phone 7 revolves around the GeoCoordinateWatcher class.  This class is what you would initialize to start listening for events:

   1: GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Low);
   2: watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
   3: watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);

As you can see, this watcher class looks for Status and Position changes.  The status is about the device peripheral itself (initializing, reading, etc.).  Position is more likely what you are interested in and would give you the details of where the device is reading the current location (longitude and latitude).  In the emulator right now the status will always return Disabled.

It’s relatively simple to simulate this, and here’s a really simple mock class for doing so.  Now, note this is not a complete emulation of the Location services APIs for Windows Phone 7 SDK.  This mock is to simply simulate a coordinate location and position changing.  The GeoLocationMock class implements the IGeoPositionWatcher<GeoCordinate> interface for mocking the location service.  There is a Start, Stop, PositionChanged and StatusChanged methods and events (TryStart is implemented, but simply calls Start).  To implement the mock in your application you would instantiate watcher (using above sample) as IGeoPositionWatcher<GeoCoordinate> instead of the GeoCoordinateWatcher specifically.  Here is a sample, and then an explanation:

   1: public partial class MainPage : PhoneApplicationPage
   2: {
   3:     IGeoPositionWatcher<GeoCoordinate> watcher;
   4: }
   6: private void StartLocationService(GeoPositionAccuracy accuracy)
   7: {
   8:     if (watcher == null)
   9:     {
  10:         GeoCoordinateEventMock[] events = new GeoCoordinateEventMock[] {
  11:             new  GeoCoordinateEventMock { Latitude=34.4, Longitude=11.2, Time=new TimeSpan(0,0,5) },
  12:             new  GeoCoordinateEventMock { Latitude=31.4, Longitude=21.2, Time=new TimeSpan(0,0,1) },
  13:             new  GeoCoordinateEventMock { Latitude=34.3, Longitude=28.2, Time=new TimeSpan(0,0,2) },
  14:             new  GeoCoordinateEventMock { Latitude=32.4, Longitude=34.2, Time=new TimeSpan(0,0,3) },
  15:             new  GeoCoordinateEventMock { Latitude=31.2, Longitude=37.2, Time=new TimeSpan(0,0,4) },
  16:             new  GeoCoordinateEventMock { Latitude=33.73, Longitude=39.2, Time=new TimeSpan(0,0,5) },
  17:             new  GeoCoordinateEventMock { Latitude=31.87, Longitude=41.2, Time=new TimeSpan(0,0,6) },
  18:             new  GeoCoordinateEventMock { Latitude=11.81, Longitude=42.2, Time=new TimeSpan(0,0,7) }
  19:         };
  21:         watcher = new EventListGeoLocationMock(events);
  22:         watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
  23:         watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
  24:     }
  26:     watcher.Start();
  27: }

The ‘watcher’ is created using a list of geo location points in this sample above.  Now this could be some web service that does IP address reverse lookup or use hard-coded examples as well like I’ve done above.  Using this mock above and replacing it in the LocationServiceSample in the SDK, here’s what my screenshot shows:

Geo location services mock for Windows Phone 7

So you can see I can start the GPS emulation and simulate subtle position changes (or drastic ones if I wanted, aka maybe a social network map application of sorts).

Hopefully this little snippet will be valuable to play around with or expand upon for your needs.  If anything, you can create some emulation of the behavior temporarily.  The mock object used in a modified LocationServiceSample project can be downloaded here: LocationServiceSampleWithMock.zip.

Hope this helps!

UPDATE: Peter Torr actually had another geo location mock in his MIX10 talk which his code is now available for download.  It is much more comprehensive emulating accuracy, etc.  The above is a simpler approach, but both will get the job done depending on what you really need/want to emulate.

This work is licensed under a Creative Commons Attribution By license.

| Comments

So the news is out! 

Silverlight IS the platform for Windows Phone 7 Series development!

Sweet.  We also made available an update to Silverlight 4 that you might be interested in too!

Windows Phone 7 SeriesYou may be wondering how you get started.  If you are new to Silverlight, I recommend getting familiar with Silverlight first.  You can find all the tools you will need at the Silverlight community site.  In addition to the core tools you’ll want to get the Windows Phone Developer Tools CTP.  This will add to your Visual Studio 2010 installation (or install Visual Studio Express) to enable Windows Phone and XNA Game Studio development.  Be sure to read the documentation on the release notes to understand any limitations.  A link to the tools, documentation, developer/UX guides and more can be found on the Silverlight for Windows Phone page.  The key elements you’d want to get  are:

I’ve also taken some quick time to get some quick videos up for some tips and familiarity with the tools and some initial areas you’ll want to take a look at.  Here are some starting videos for you:

The getting started video has some quick tips and tricks about the emulator and using the keyboard input control (referred to as the ‘SIP’).  I suggest taking a look at these for some primer.  If you have questions afterwards, check out the dedicated forum for Silverlight for Windows Phone.

I’m looking forward to seeing what you’ll develop using Silverlight for Windows Phone!  Be sure also to watch for @ckindel and @wp7dev on Twitter for information about Windows Phone 7 Series development.

This work is licensed under a Creative Commons Attribution By license.