LP Pinsonneault blog's

Windows 8, Windows Phone, ...


Windows Phone 7 Developers Briefing in Montreal

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

December 7

Intercontinental Hotel
360 Rue St Antoine W
Montréal (Québec) H2Y 3X4

Registration link


Other cities:

Register Today:

Ottawa, On – November 30, 2010
Calgary, AB – December 01 2010
Mississauga, On – December 2010
Montreal, QC – December 7 2010
Toronto, On – December 9 2010

See you there!


Presenting at .NET Montreal Community on Windows Phone 7 on Monday November 15th

windows_phone_introTomorrow, it'll give a full session at the .NET Montreal Community about Windows Phone 7. In that session I'll give a full end to end overview of my experience building applications for Windows Phone 7. So I'll start with the idea through the development process and finally publishing the application to the marketplace.

If your interested, I’ll be also available to answers your question. I’ll also have a device so you can test and feel the new OS which is now available since November 8th.

For more information : http://www.dotnetmontreal.com/.../Default.aspx?selecteddate=15/11/2010



See you there!

Windows Phone 7 – Suspend mode

Recently i was publishing an updated version of an application on the Marketplace for Windows Phone 7, and my update failed the testing process.


Comments: The user isuse  presented with an error message when the location services are disabled on the device. The error
message that is displayed is not a user friendly message.
Steps to reproduce:
1. Turn on location service on device.
2. Launch the application and select a location
on the venues page.
3. Swipe to the map page and select view map.
4. When map is loaded press the Start button on the device. 5. Go to the settings of the device and turn off location service.
6. Press the Back button from the Start screen of the device to reactivate the application.
7. Notice a non-user friendly error notification appears.

Real reason
In reality the problem is not related with the location services. Because i don’t use the location service (i only use the Bing Map for display only).  In fact, the real problem it’s that i forgot to handle the Deactivated event and the Activated event.

Why do we have to handle the Activated and Deactivated event?
Windows Phone 7 doesn’t support multiple application running at the same time (except for some application approve by Microsoft). But when your application is running, for different reason (incoming phone call, the user click the start button, …) the application can be suspended. To eliminate some issues you should handle those event and make sure you persist important information.


One of the best place to handle these events is in the App.xaml. To do so you need to declare the events in the xaml code.

        <!--Required object that handles lifetime events for the application-->
            Deactivated="PhoneApplicationService_Deactivated" />

In the Activated event, you can store some data in the the Microsoft.Phone.Shell.PhoneApplicationService.Current.State dictionary. And in the Deactivated event, we can retrieve that information.

Make sure to test any scenario that a user may face. Currently, the testing process that Microsoft implemented is pretty exhaustive (which is good because it help ensure that the application in the Marketplace won’t crash).




Important update about the PDC and Silverlight

Last week at PDC, Bob Muglia (President of the Server and Tools Division at Microsoft) have been interviewed about Silverlight vs. HTML5. In the interview, he sais “Our Silverlight strategy and focus going forward has shifted.” . Today, he publish a letter to apologize an drectify the meaning of his word which cause some confusion.

Here is the letter: http://team.silverlight.net/announcement/pdc-and-silverlight/

“Make no mistake; we’ll continue to invest in Silverlight and enable developers to build great apps and experiences with it in the future.”,Bob Muglia

In clear, Silverlight is there and will continue to evolve more than ever.


IE 9 and Debuging in Visual Studio

Some of you probably find out that the beta version of IE9 seems to cause some issues when we want to run an ASP.NET or Silverlight in debug in Visual Studio. In reality, there is no issue. In fact, it’s IE9 who is too fast, compare to the Web Development Server (also called Cassini) which take longer to instantiate. A friend of the .NET Montreal Community Étienne Tremblay found a workaround for this issue. He wrote a post about his solution: http://geekswithblogs.net/etiennetremblay/archive/2010/10/07/ie-9-cassini-and-the-dreaded-dns-error-or-page.aspx

I tried it and it work fine for me!

Thanks Étienne!


Montreal .NET Community : Developing Silverlight/WPF for Blendability: Smooth Developer/Designer Workflow

This thursday Barry Garvin will present an interesting session at the Montreal .NET Community.

Here is his presentation description:

Microsoft has continued to make investments in both Expression Blend and Visual Studio to facilitate the workflow between the designer and developer roles. This is even more important if you as an individual fulfill both of these roles. However, having version control support in Blend and a design surface in Visual Studio 2010 isn't enough to ensure this back and forth workflow is smooth. In this session we'll examine techniques and patterns to ensure that your projects remain "Blendable" and "Testable" from start to finish. We'll review patterns such as model-view-view-model and attached behaviours to provide not only clean separation of concerns and testability, but also that elusive "Blendability" allowing you to take advantage of Blend's power throughout your project.

For more information : http://www.dotnetmontreal.com/.../Default.aspx?selecteddate=05/10/2010

See you there.


Building a Windows Phone 7 application: Part 2 - Implementing the UI

Part 1 - Accessing the data

In this second part, i explain how i implement the user interface.

Implementing the UI

Windows Phone 7 application are based on Silverlight 3. Which mean that the interface are build with XAML. In fact, there is not much difference if we compare to a standard Silverlight application. There is some limitation that we need to keep in mind when we create the UI for the Windows Phone 7. First, the screen size is limited to 800x480 or 320x480. This is not a real limitation, it only a limitation of the viewing zone. Also, because WP7 is base on Silverlight 3, you won’t be able to use all of the third party control available on the market (at this time). I want to remember you that we are currently working with a Beta version, feature may change in the future.

In some of my previous blog I've wrote about some WP7 control. Among those control are the Panoramic and Pivot control. We see those control in most of the demo but they are not built-in control at this time. So for now we need to implement our own or use a third party controls set. So in my application I'm using a control that is really easy to use and which is available at CodePlex. You can access the control project using the following link http://phone.codeplex.com/.
So for one of the main UI of the application i decided to test the Panorama control. This was easier than i expected.



2010-07-04 12h50_25

One of the problematic I've faced is to display the speakers in a list. I wanted to have those speakers to be displayed in 2 columns. The WrapPanel from the Silverlight toolkit is the control that can help to resolve that situation. But i wasn’t able to use the current DLL because it was build for Silverlight 4. So as mentioned on some of the blog one of the solution is to import the class directly in the project. So this is what i did. I had to fix the class to be able to compile.

To personalized the item, i created a new template to display the picture of the speaker and his name. I’ve added a little bit of glass effect. To do that i used some rectangle that i converted in path. Combine with the proper gradient you can do some great effect  very easily.

2010-07-04 13h20_53


Here is the XAML for the template :

<DataTemplate x:Key="DataTemplateSpeaker">
<Grid Width="175" Height="200">
<Border HorizontalAlignment="Stretch" BorderThickness="1,1,3,3" CornerRadius="10" Margin="0,0" RenderTransformOrigin="0.5,0.5" Padding="4" BorderBrush="#FFACD0FF" >
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#3FFFFFFF" Offset="0"/>
<GradientStop Color="#7FAFAFAF" Offset="1"/>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2">
<RowDefinition Height="110"/>
<RowDefinition Height="4"/>
<RowDefinition Height="60"/>
<Image HorizontalAlignment="Center" Width="90" Stretch="Uniform" Grid.Row="0" Source="{Binding adx_partialurl, Converter={StaticResource SpeakerPictureConverter}}"/>
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding adx_name}" VerticalAlignment="Center" Grid.Row="2"/>
<Path Data="M0.5,0.5 C69.528435,1.1737753 135.80814,1.1603669 199.5,0.5 L199.21571,44.151123 C135.53889,26.307547 68.447166,29.901087 1.6371429,47.084667 z" Stretch="Fill" UseLayoutRounding="False" Margin="0,2.25,0,78.5">
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19FDFBFB" Offset="0"/>
<GradientStop Color="#26FFFFFF" Offset="1"/>

2010-07-04 13h32_04

In Windows Phone 7, compare to Silverlight some page template are not available at this stage. One of them is the Child page. So i created a user control that simulate the child page. Combine with the Pivot control this allow to have more information inside the window.

In the latest beta version, some change improve how we design the application. First Blend now integrate a manager that help creating the navigation bar. So we no longer have to manage the application bar directly in code.

2010-07-22 08h21_18

Also each icon in the navigation bar must have a text which will be displayed when the application bar is opened.

2010-07-22 08h26_47

2010-07-22 08h34_04 

Moving to the Beta version

This application was create with the CTP April Refresh of the Developer Tools. So upgrading to the Beta version was pretty straight forward. Mainly the refactor they did in the assemblies will simplify the referencing. So in this application i had to remove any obsolete reference and add a reference on the Microsoft.Phone.dll. After i had to go through each XAML page in my application and change the namespace declaration to refer the appropriate DLL.


The other change i had to go through is adding the Text to any button in the application bars.

And the last change I've been able to do is to refer to the signed assembly for System.Data.Services.Client.dll. So now (like i said in my previous post), the is no need to fix any signed assembly like we had to do with the CTP April version.



This project is still in progress. I have a couple of ideas to implement. Here is a list of what i have in mind:

  • Implement the localization of the event using Bing Maps
  • Integrate a session scheduler
  • Manage the multi-language (English and French)
  • Implement a notification service
  • Implementing caching so the application will work offline


So in conclusion my experience with programming with WP7 is very simple and easy. The experience i got over the past year with Silverlight reduce significantly the learning curve. That what i like with it, because i can focus on learning specific feature related only to WP7 (Application Process, Hardware feature, etc.). This is only the beginning!

So come back often as i will continue to blog about this project and other related subject like WP7, Silverlight, Blend.


Building a Windows Phone 7 application: Part 1 - Accessing the data

imageA couple of week ago, the Microsoft TechDays Canada team have publish all data using ODATA. So i said to my self this will be a good hand-on for creating a WP7 application and exploring ODATA at the same time. So I've started to build an application while exploring most of the current feature available.


2010-07-04 10h20_07

First i started to look at the data structure of the TechDays.ca ODATA. The object available are Events, Schedules, Speakers, Speaker Tags, Tags, Tracks, Venues, Annotations. So there is plenty of information to build a pretty advance application. I’ve started with the Venue because most of the data are related with the Venue which are the city where the TechDays will stop. So I've just create a simple list of button to which will allow me to access the information related to the selected Venue.

Accessing the data

The first thing to do (after the creation of the Project in Visual Studio) is to create the proxy class the will interface the WCF Data Services and the ODATA format. Currently we cannot add Service Reference using Visual Studio for Windows Phone 7 project. I hope this will be added in a future version. So for now you need to create that class manually by executing the DataSvcUtil.exe in command line:

DataSvcutil.exe /uri:http://www.techdays.ca/OData.svc /DataServiceCollection /Version:2.0 /out:TechDaysODataType.cs.cs

So you can now import that class in your project. But if you try to compile it will fail because you are missing a reference. You need to import the System.Data.Services.Client.dll .

 Note: There is currently an issue with the Windows Phone Toolkit April CTP with some Authenticode signed assemblies so i had to fix the System.Data.Services.Client.dll  to be able to work with WCF Data Services. Tim Heuer post an article with the instruction on how to fix the affected assemblies : http://timheuer.com/.../windows-phone-tools-update-april-2010-silverlight-xna.aspx
This issue is now fixed in the current beta release.

imageCurrently, I’ve created a library to handle the data. I created an helper that simplify the data query inside the Windows Phone application. This eliminate a lot of code that can often be duplicate. So in the constructor of my helper class TechDaysProxy.cs i instantiate the WCF Data Services client

public TechDaysProxy()
ODataContext =
new Xrm.XrmDataContext(
new Uri("http://www.techdays.ca/OData.svc/", UriKind.Absolute));
CurrentLanguage = LanguageType.English;

Once we have access to the data context we can query the data. So with WCF Data Services which is in this case an implementation of REST. Every query Linq are converted to REST query. If we want to query the object adx_venues we can do it this way:

public void GetVenuesAsync()
var Venues = from v in ODataContext.adx_venues select v;
collectionVenues = new DataServiceCollection<Xrm.adx_venue>();

collectionVenues.LoadCompleted +=
new EventHandler<LoadCompletedEventArgs>(collectionVenues_LoadCompleted);
This will return the a collection of adx_venues. By default, none of the child element will be loaded. So there is 2 ways to load child element. You can modify the LINQ query to add the Expand keywork to include a child table in the result. This may simplify the process but in some case it can increase the delay of getting the information back from the server.
var Venues = from v in ODataContext.adx_venues.Expand("adx_eventspeaker_venue")
select v;
The other way, is to get load the information asynchronously. So when we get the data back we load dynamically the child table so we can start displaying some information while the remaining still in process of loading. 
void collectionVenues_LoadCompleted(object sender, LoadCompletedEventArgs e)
foreach (Xrm.adx_venue v in collectionVenues)

None of those method are better. You need to apply the proper one base on the context of your application.
This is simple for any other object you may implement the same logic. So there is not much code to implement here.
2010-06-12 22h55_042010-06-12 22h06_182010-06-12 22h07_36
2010-06-12 22h07_592010-06-12 22h08_242010-07-04 12h50_25



PART 2: Implementing the UI

Reporting with Silverlight 4

A new project on CodePlex have just been launch. Silverlight Reporting is an new project created by 2 guys from Microsoft (Pete Brown and David Poll) decided to create a framework that will simplify the reporting with Silverlight 4. As you may know, Silverlight 4 already support printing and pagination but every time you want to generate a report you need to handle many thing manually. This framework which is at is initial release will simplify the process of generating simple report.

Here is a list of the feature included in the initial release:

  • automatic pagination
  • support for line items of varying height
  • total page count
  • templating
  • page headers and footers
  • event to allow hooking into printing at various stages

You can download this framework on CodePlex: http://silverlightreporting.codeplex.com/

(Report generated using the sample and printed using the XPS Printer Driver)

I’ve looked at the sample and it’s very easy to use. I’ll looking forward to use it in some of my projects.


Expression Studio 4 now available

Microsoft just launch the latest version of Expression Studio (Blend, Web, Desing, Encoder). If you have an MSDN Subscription, you can now download the latest release.

Important Note
If you are developing with Windows Phone, Tim Heuer indicate that we must still use Expression Blend 4 Beta until they finalize the development tools for Windows Phone.

Expression Blend 4 New Features include:

  • VS2010 compatibility
  • Windows Phone support
  • Deeper Adobe Photoshop import (layer effects)
  • New behaviors & conditional behaviors
  • Enhanced sample data support
  • Listbox path layout for designing with data
  • Pixel Shader effects (including animations)
  • Easier styling and customization
  • Model View View-Model support
  • Mockup controls for SketchFlow

Expression Web 4 New Features include

  • SEO Reporting from inside of the application
  • New extensibility model enables creating add-ins with HTML, JS, and CSS
  • New SuperPreview online service beta for browser compatibility testing now supports Macintosh Safari

Expression Encoder 4 Pro New features include

  • Live Smooth Streaming (VC-1 & H.264)
  • New H.264 encoder from MainConcept
  • Enhanced Screen Capture
  • DRM (PlayReady) for Live Content

For further, information read the blog post of Tim Heuer or go on the Expression Website: