HarborObjects

Windows Phone 7 Hands On Lab

by RezaMadani 17. September 2010 04:19

The first official Mobile Phone 7 Hands-On-Lab in Southern California was held at QuickStart Office in Irvine, CA this past Saturday September 11th.  I was lucky enough to be one of the presenters along with Mark Rosenberg.  Chad Boyer was one of the proctors helping out quite a bit with people’s questions.  I have to admit I expected a positive response but not to this extend.  We literally ran out of seats and there was physically no room to sit about an hour into the presentations.

If you are interested in learning about WP7, this 12-hour day is for you.  The labs and lectures are skillfully created and narrated by Daniel Egan from Microsoft.  They cover all the key features of the phone.  At the end of the day you get to take the fully completed version of the lab with you home.

There were two questions asked frequently during the labs that I’d like to shed some light on:

-          Missing ApplicationBar icons

When you pick an icon to display on your application bar, you will notice that an ugly X is displayed instead when you run the application in the emulator. This is due to the fact that the ‘Build Action’ of Images added to the application is set to ‘Resource’.  To view this setting simply right mouse click on one of the images in Images\Icons fodler and select Properties.  Switch this setting to ‘Content’ and make sure ‘Copy to Output Directory’ is set to ‘Copy Always’.  This is due to the fact that your image files are added to the xap package as separate files and not resources.  To prove this to yourself, navigate to the bin\Debug directory of the application, change the extension of the xap file to zip and double click it.  You will see that the images are included as separate files in the target compressed xap file.  To refer to this kind of file, your ‘Build Action’ must be set to ‘Content’.

 

-          Global definition of an ApplicationBar

You can move the definition for an applicationBar to your app.xml where application wide resources are defined:

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

 

   <shell:ApplicationBar x:Key="GlobalAppMenuBar"

                              IsVisible="True" IsMenuEnabled="True"

                              BackgroundColor="#FF0000" Opacity="1.0" >

         <shell:ApplicationBarIconButton

  <shell:ApplicationBarIconButton

 

        </shell:ApplicationBar>

 

App.xml entries are simply name/value pairs in a hash table.  You refer to them from any xml page of your application using their Key.  From now on whenever you add a new Windows Phone 7 Page (either Portrait or Landscape), you should notice that all pages are of type phone:PhoneApplicationPage. These pages have a property called ApplicationBar similar to FontSize or DesignHeight properties.  Simply set it to your global definition using the following syntax:

ApplicationBar="{StaticResource GlobalAppMenuBar}"

 

As a result whenever you update your global definition of the ApplicationBar all pages get updated automatically.

Btw, the last three hours of the day are allotted for implementing something on your own and present it at the end.  Your application will be judged with the first place winner taking a $500 gift card, the second place winner a $200 card and the third place winner a $100 one.  The first place winner on September 11th blew my mind.  He had an almost fully functional XNA shooting game to blow up spaceships – very impressive.

Let me summarize WP7 programming for you.  If you know Silverlight or XNA programming, you are 95% there.  The rest is simply getting to know the specific phone features such as GPS, Accelerometer and their associated APIs.  I anticipate hundreds of applications readily available as soon as the phone is released. 

The next two HOL sessions are on September 25th (QuickStart, San Diego) and September 26th (QuickStart, Irvine). Enjoy.

Tags:

Silverlight | Windows Phone 7

Silverlight Tips & Tricks

by RezaMadani 10. August 2010 04:41

Here is the slide deck and code samples for my presentation at the LA .NET user Group.
1- To Load the demos, you need the following:
  - Visual Studio 2010
  - Silverlight 4 tool kit (from msdn)
  - AdventureWorks 2008 database, preferably 2008 R2 (from Codeplex) - the data warehouse is not necessary for these demos
2- Once you open the project in VS2010, Create the Stored Procedure called getProductsByCatSubcat in your AdventureWorks database (attached)
3- Change the AdventureWorks2008R2ConnectionString password, db name etc. in web.config
4- To bring up each sample, change the startup page in Application_Startup method of app.xaml.cs file.
5- I have hardcoded the web server port number as 54931 in WCFBasicConsumer.xaml.cs.  Make sure to change it to whatever yours is.  Technically this should be passed in from a config file in a real production environment.

Have fun and as always let me know if you have any questions.

 getProductsByCatSubcat.sql (1.20 kb)

Silverlight Tips & Tricks- LA UG.pdf (124.60 kb)

SilverlightTipsTricks.zip (121.49 kb)

Tags:

Silverlight

Silverlight 3.0 MSDN Broadcast

by RezaMadani 15. May 2009 04:26

For those of you who attended my MSND broadcast on Silverlight 3.0 ‘simple but effective animation techniques’ on Channel9, I have just uploaded the code for both version 2.0 and 3.0 of Silverlight.  The 3.0 version has one additional demo focusing on the new cool effects you can apply to UI elements.  The demo specifically shows the shadow effect.  This feature has been available in WPF and it is now available in Silvelight.  The rest of the demos are identical.

SilverlightEffectiveAnimation20.zip (40.95 kb)

SilverlightEffectiveAnimation30.zip (45.63 kb)

Tags:

Silverlight

Silverlight Animation & Databinding Presentation

by RezaMadani 6. April 2009 04:37

For those of you attending my Silverlight Animation & Data Binding presentation in San Diego, I just posted the slide deck and sample code(s).  As always please register on the site, log in and go to Company/Articles menu and grab the stuff.  Demos should be self explanatory - or at least that’s what all developers say.  Make sure to have AdventureWorks database (2005 or 2008) installed.  Some of the data binding demos require it.  Drop me an email if you have any questions.

Silverlight Animation-DataBinding-Mar2009.zip (633.36 kb)

Tags:

Silverlight

Silverlight 2.0 HOL

by RezaMadani 6. February 2009 04:09

If you attended any of the Hands On Labs for Sivlerlight 2.0, you will find a few minor errors in the documentation that will slow you down or confuse you.  I have done my best to capture them in this document: “Silverlight hand on lab notes.pdf”,  Use it alongside the documentation provided by the lab.  This would require you to register on the site.

Silverlight hands on labs notes.pdf (78.23 kb)

Tags:

Silverlight

Silverlight 2.0 Training Labs

by RezaMadani 8. January 2009 04:24

I will be a proctor for a 3:00 hour training session on Silverlight 2.0 this January 15th at QuickStart Facilities in Irvine from 6:00PM to 9:00PM. The session was full in less than an hour after announcement! This is a great MSDN event since everyone will be provided with a virtual machine to get hands on experience developing code for Silverlight. I am working with Microsoft and other OC.NET user group folks to see if we can repeat the session sooner than later. Lynn Langit of Microsoft is working hard to arrange at least two more presentations in Irvine and San Diego within the next two months. If possible, I will be arranging earlier sessions here in Orange County. Additional details can be found here.

Tags:

Silverlight