LP Pinsonneault blog's

Windows 8, Windows Phone, ...

NAVIGATION - SEARCH

Install experience on a real Windows Phone 7 device

Last Friday Christian Beauclair of Microsoft did an install clinic in Montreal. So i scheduled an appointment to install the application I'm currently building for the TechDays. I was really impressed by the quality of the OS. It run really smooth and faster compare to it predecessor WM 6.5. 

To install the application on the device we took the XAP file and deploy it to the device using the XAP Deployment application.

2010-09-12 17h00_12

I was surprised because the application was running smoother on the Device compared to the Emulator (animation, progress bar, etc.).

But when there is some issue related with the development. Like in my case, the application need to get a lot of information from a web service and  I was getting most of the information at the start-up of the application, which was wrong. So i took some time to convert to use a MVVM approach, which increase the performance of the application. So now I'm downloading only the data that i need. Next step, is to apply this technic to every page in the application. That was a great experience, this confirm that the experience on with the emulator in pretty similar.

Also when i was fixing some issues, i was able to test the debugging on the device. If you doesn’t know you can debug you application the same way your doing it on the emulator but directly on the device. So if you have any issue related directly to the device you will be able to fixe it directly with the device.

An important note for the developers who want to deploy the application directly to a device like i did, when you will get a device you need to create an account on the Marketplace to deploy the applications you are creating. Then you will be allowed to unlock 3 devices. What I'm saying by unlocking a device, it unlock the OS so you can deploy. This doesn’t remove the lock from the carrier.

Next step, getting the RTM version of the Developer tools on Thursday, September 16 2010. After what we will have to wait for the real device which will be available for the holidays.

Until then if you have created any Windows Phone 7 application, don’t miss the Deployment clinic in a city near you . You can look at some event date at Canadian Developer Connection.

Regards,
LP

Got my new Kindle!

At A Glance imageSince a couple of year i was watching my brother reading with his Kindle. Since a couple of year i was increasing my eBook collection but I'm not a big fan of reading on my pc. As a developer, i usually read technical book. Most of the time those book are pretty big and heavy. So this summer i finally decided to order the new version of the Kindle. This solve most of my problem about reading some book. So now i can have my whole eBook collection with me at anytime.

I’m very impressed by the device. The screen is so magical. When you watch the screen you don’t believe you are reading on an electronic device.  The 6” screen is perfect size for me. It’s not too big and not too small. And for the weight, we cannot compare to device to a book because it’s so light.

Currently most of my eBook are currently in PDF. This device can read PDF. But, the PDF reader is not the best for the 6” device. Usually the eBook display the proper amount of text the be easily read by the user. But when we read a PDF i display the whole page. So you have to zoom in the page to display and move the zoom area to read the page. So in my opinion this will need some improvement.

On the other side, there is some workaround to solve this issue. You can use some software to convert the PDF to a compatible eBook format like “.mobi”. So you can use MobiPocket to convert the PDF and manage your eBooks.

MobiPocketMenu

Or you can use Calibre. This is the current software I'm using.

The device include some experimental feature like the web browser, which work very well. The pages are rendered very nicely.

Also there is a text-to-speech feature, which allow you to listen while you Kindle is reading you book for you. And i can confirm you that this feature which still experimental work very well.

In conclusion, i can only recommend the latest Kindle. For 139$, every developer should have one, so they wont have to bring their 5 pounds book everyday.

Regards,
LP

Silverlight Service Release 4.0.50826.0

Microsoft release today a service release for Silverlight. This service release fix issues that were in introduce in the RTW version:

  • SDK feature to enable Add New Row capabilities in DataGrid control
  • Improving startup performance of Silverlight applications
  • Adding mouse wheel support for out-of-browser applications on the Mac platform
  • Various media-related fixes around DRM content
  • Fixed memory leak when MouseCapture is used
  • Fixed memory leak for DataTemplate usage

Lately i was working on project that were affected by the DataTemplate memory leak. So i was waiting for that fix. I hope this will help.

The only thing we need to do to apply the latest change is to set the “minRuntimeVersion” and “autoUpgrade” int the object tag:

<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />

For more information:
http://timheuer.com/blog/archive/2010/09/01/silverlight-service-release-september-2010-gdr1.aspx

Regards,

LP

Windows Phone 7 (Release to Manifacturing)

Today there was very interesting news. Windows Phone 7 was Released to Manufacturing. This is a really good now because it mean that they are on the good track to release some phone to the market for the holidays.

To read more about the news:
http://windowsteamblog.com/windows_phone/.../windows-phone-7-released-to-manufacturing.aspx

Regards
LP

Summer review!

This summer is going to fast! Mainly i was working on many project at the same time. I was lucky because most of them were Silverlight. So i had reduce the time i had to work on my blog. Now most of them are completed. So i expect to have more free time to play with Windows Phone 7, read some books and wrote some blogs.

So this autumn will be exiting. First the development tools for Windows Phone 7 will be finalize and released on September 16th. I’m can wait to work with it. So as soon as I can, I will convert the application for the TechDays I'm working on and I'll publish the source code on Codeplex.

On the community side, i will do a presentation on Windows Phone 7 (November 15th) at the .NET Montreal user group. I expect to have a lot of fun for this session has i have a lot of information to share. Also for those who assist at user group there is a “Speaker Idol” again this year. I encourage everyone who want to share his passion about .NET to participate. It the way i begun speaking. I’ll be there to encourage all the participant.

Again this year, Microsoft Canada organized the TechDays which will stop in Montreal on November 23-24. There is a great list of session. Again, i will probably speak at this event (subject need to be confirmed) again this year.

Have fun coding!
LP

Top 10 Things I Wish I Knew Before I Started My Silverlight 4 Project

Recently i wrote an article for Redmond Developer News about the “Top 10 Things I Wish I Knew Before I Started My Silverlight 4 Project”. In the article, i wrote about some of the new feature that you may look before starting a Silverlight 4 project.

So you can read the article using the following link:
http://reddevnews.com/articles/2010/07/29/top-10-silverlight-tips.aspx

Regards,
LP

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.

Panoramic

 

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" >
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#3FFFFFFF" Offset="0"/>
<GradientStop Color="#7FAFAFAF" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Border.RenderTransform>
<CompositeTransform/>
</Border.RenderTransform>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2">
<Grid.RowDefinitions>
<RowDefinition Height="110"/>
<RowDefinition Height="4"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<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"/>
</Grid>
</Border>
<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">
<Path.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19FDFBFB" Offset="0"/>
<GradientStop Color="#26FFFFFF" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
</Grid>
</DataTemplate>


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.

xmlns:navigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"


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.

 

Roadmap

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

Conclusion

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.

Regards,
LP

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);
collectionVenues.LoadAsync(Venues);
}
 
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)
{
v.adx_venue_track.LoadAsync();
v.adx_eventspeaker_venue.LoadAsync();
}
...
}

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
 
 

 

image

PART 2: Implementing the UI


Windows Phone Developer tools now in Beta

Today is the release of the latest developer tools for Windows Phone 7. And with this release, another step have climb, because the tools are now in Beta. When you look at the release note you will see that there is a lot of braking change. They work a lot in refactoring stuff like merging multiple DLL in a single assembly. The application bar now required a value on the new “Text” property.

It seems that we will now be able to use Expression Blend 4 RTM. In fact, with the tools now provide a new version of Expression Blend 4 that will run side by side with the RTM version. This version is specific to the Phone, so you will not allowed to create other project.

So i suggest that you read the following post about those changes:
http://blogs.msdn.com/b/jaimer/.../migrating-apps-from-windows-phone-ctps-to-the-beta-build.aspx

You can download the latest version of the Developer tools here: http://www.microsoft.com/.../details.aspx?FamilyID=c8496c2a-54d9-4b11-9491-a1bfaf32f2e3

Official blog post from the team:
http://windowsteamblog.com/windows_phone/.../windows-phone-developer-tools-beta-released.aspx

And a great blog post from the Expression Blend team on the new feature:
http://blogs.msdn.com/b/expression/.../windows-phone-developer-tools-beta-released.aspx

Regards,
LP

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/

image
(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.

Regards,
LP