November 2010 - Posts

Windows Phone 7 has the FMRadio class (Microsoft.Devices.Radio namespace) that is ready to use:

FMRadio.Instance.PowerMode = RadioPowerMode.On; 

but… there are couple of things to know:

The first time you will use it, chances are that you will get an UnauthorizedAccessDenied exception with an obscure "Access is denied" message.

The problem is that the Zune software must be closed….  but if you close Zune, now when you try to build or debug (F5 or Ctrl+F5) Visual Studio complains that it can’t deploy to the device anymore: “Zune software is not launched. Retry after making sure that Zune software is launched.”

So… you need to deploy the app to the device and then close Zune, debugging might be a problem as if you hit F5 then close Zune, the app will stop; but instead you can right-click on your project and select “Deploy”:

alt 
Now you can close Zune and it should be ok, but the FM Radio only works with headset plugged or you’ll get an error notification. You can check this by code:

 

try
{
    FMRadio fmRadio = FMRadio.Instance;
                
    fmRadio.PowerMode = RadioPowerMode.On;
    fmRadio.CurrentRegion = RadioRegion.UnitedStates;
    fmRadio.Frequency = 99.5;
 
    if (FMRadio.Instance.SignalStrength == 0.0)
    {
        MessageBox.Show("Please connect your headset.");
    }
}
catch (Exception ex)
{
    MessageBox.Show(String.Format("Error: {0}\nClose the Zune
software or disconnect the phone from your computer."
, ex.Message));
} 

 

Also check the Marketplace application certification requirements document, as you need to follow some guidelines while your app plays music, like updating the “History” area of the Music hub, or asking the user his permission to play music in background.

 

Note: I was not able to make FM Radio works in the emulator, some people report that it may take long (minutes) to launch…but for me it keeps telling that headset are not connected.

 

Download my code sample

alt

Last chance to get this awesome Silverlight training in 2010! The Silverlight Tour has one more class in Montreal, and provide top Silverlight 4
content!!!

>> This course will be taught in French * <<

  • What: Silverlight training
  • When: December 14-17 (4 days)
  • Where: Montreal, Qc
  • Registration/info: http://www.runatserver.com/SilverlightTraining.aspx

    Also note that we offer a free license of Telerik's RadControls for Silverlight to every attendee ($999 value)!!
    For more information on RadControls, visit:
    http://www.telerik.com/products/silverlight.aspx
    alt

    * We do english class as well… check our website!

  • Posted by pluginbaby | with no comments

    alt I already post about this event, but want to mention that we will host a local event in Montreal.

    What: From the official event “The future of Silverlight. Hear what’s coming next from Microsoft’s Scott Guthrie. It’s just like an extra day of PDC, dedicated to Silverlight”.
    We will watch the keynote live from the Microsoft local office in Montreal, then discuss about it.

    When
    : December 2, from noon to 2pm.

    Where: 2000 McGill College, 4th floor, Montreal, QC, H3A 3H3

    More info: http://www.silverlight.net/news/events/firestarter/

    Bring your lunch, see you there!

    Posted by pluginbaby | with no comments

    Today I did a presentation on Visual Studio LightSwitch at TechDays Montreal.

    My goal was to introduce this new tool and show how it can help you create business applications for the desktop or the cloud.

    I had a few slides, then fired VS2010 and created live an application (TechDays conference manager) from scratch, showing:

    • Designer to create the Db tables
    • Wizards to create the UI (automatic screens layout)
    • Built-in insert/edit/delete with validation
    • Built-in sort, pagination and Excel export
    • Custom validation
    • Computed columns
    • Customize a Search screen with a DatePicker
    • Customize the Menu (groups)
    • Security
      • Users, Roles and Permissions
      • Screens Access control

    It was great and I hope people liked it.

    Interesting links:

    Note that I’ll do another LightSwitch presentation on April 18 at the Montreal .NET Community.


    Download the slides *


    Download the app (LightSwitch beta 1)

     

    * Thanks to Orville McDonald for the slides!

    My Windows Phone little application

    My first WP7 app is available on the Marketplace: Morse Code Flash Light.

    Try it, it’s free.

    Morse Code WP7 app

    It converts any text to Morse code and use your phone as a flashlight to 'read' it.
    Features supported (v1.0):

    • Translate text in Morse code
    • Display it by flashing your screen
    • Change speed (“official” morse speed is 100ms per dot)
    • Repeat function
    • “Shake for a random word” function!
    • Support both portrait and landscape orientation
    • Optimized for dark & light themes.

    So this little piece of software was my excuse to try developing for Windows Phone 7 (and deploy it to the Marketplace). As an experienced Silverlight developer I learnt quite a few things specific to the phone, so this was an interesting experience and I can’t wait to build more mobile apps for this platform!

     

    My Experience (and a few tips)

    Very good! Windows Phone dev is not surprising at first, you get all the goodness of developing with Visual Studio 2010, C#, .NET, Silverlight… but you need to apply this to a phone, with very specific constraints (screen real estate, performance, touch, …), hopefully you can find plenty of resource to help (read my conclusion below).

    Here are a few things that comes out of my mind right now:

    • The best way to test your app in the emulator seems to set zoom level to 66%.
    • No implicit Style surprised me at first (too used to SL4…) but that’s not a big deal.
    • No binding on Dependency Object (same as above)
    • Forget about hyperlinks… you need buttons, big buttons in this touch world.
    • I can’t find a way to localize the splash screen, as it is not like browser Silverlight in browser, the phone rely on a SplashScreenImage.jpg picture.
    • While testing in the emulator, you can toggle virtual/physical keyboard with these shortcuts: page up / page down.
    • Cyclic navigation is discouraged. This was the most difficult part to understand at first. Navigate Home Page/Page 2/Page 3/Home Page, then hit Back button… you need to leave the app (and not back to Page 3). Avoid forward navigation, go back if needed, but you don’t have access to the navigation history, so there is no built in solution here, after 2 failures to pass Marketplace certification, it leads me to delete my common app menu bar… I just have 3 pages in my app: Home/Morse/About, but having a menu on each page with all 3 navigation buttons was a big no-no.

     

    My Conclusion (and a few links)

    Being a Silverlight developer does not automatically makes you a (good) Windows Phone developer, it helps for sure but you need more. You need to learn the specifics of Silverlight for the mobile platform, and there are a lot! You need to OPTIMIZE your code AND layout, even for small or basic apps, because if not you’ll get poor performance and users won’t like it. So… I think a Windows Phone developer is a good Silverlight developer... what I mean is knowing how to build good apps for the phone (limited screen real estate, limited performance, …) makes you a better Silverlight dev.

    Also... you have to learn the rules to get your app certified in the Marketplace, or you will fail to certify, promise.
    Reading this is not an option:
    Windows Phone 7 Application Certification Requirements [PDF]

    Incredible WP7 dev tips (good reading):
    http://blogs.claritycon.com/blogs/kevin_marshall/archive/2010/10/26/wp7-development-tips-part-1.aspx

    Another resource you *should* read to design your WP7 apps: 
    UI Design and Interaction Guide for Windows Phone 7 v2.0 [PDF]

    Knowing your input scopes:
    http://www.kirupa.com/windowsphone/visualizing_inputscopes.htm

    And finally just in case you missed it Jeff Blankenburg did an amazing “31 days of Windows Phone 7” blog post series:
    http://www.jeffblankenburg.com/post/31-Days-of-Windows-Phone-7.aspx

     

    Have fun!

    Join us at the Microsoft Windows Phone 7 Briefing for Developers!

    windows phone developer briefingsWant to learn how to create awesome applications and games for Windows Phone 7?

    Want to extend your existing apps onto a new platform?

    Want recognition, exposure, and reach in an untapped marketplace?

    RunAtServer will be presenting this Windows Phone 7 Briefing on behalf of Microsoft, you will learn more about developing on it’s latest mobile platform.  The briefing will cover three sessions exploring the two application frameworks available for Windows Phone 7, where to find developer resources, how to submit apps into Marketplace, and much more!

    Session 1
    6:00pm - 7:00pm - Apps with Silverlight
    Session 2
    7:15pm - 8:15pm - Games with XNA
    Session 3
    8:30pm - 9:00pm - Next Steps

     

    When:
    December 7

     

    Where:
    Intercontinental Hotel
    St-Jacques
    360 Rue St Antoine W
    Montréal (Québec) H2Y 3X4
    Canada


    Registration link
    https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032470418&Culture=en-CA

    Come and discover the world of Windows Phone programming, it’s free!


    I already mentioned this event here, but if you are interested in the future of Silverlight you MUST watch the keynote of the Silverlight FireStarter event! (Live streaming on December 2)

    http://www.silverlight.net/news/events/firestarter/

    ScottGu Powaaa 

    (picture from my friend Guy)

    More Posts