Adam Benoit

Windows Phone Development

Age Tracker: Source Code

Posted on

by Adam

This application is the second one I wrote for the Developer Movement “contest” by Microsoft. The “prize” I chose was a Nokia Lumia 800 which I received last Monday.

I was working on another app for the contest but had an idea for another one when I was asked a few times how old my daughter was. At her age we’re basically counting months so I figured, I would make an app to tell me exactly how old she is. While I was at it I would make it save mine and my wife’s birthdays as well.

I stated off making a class to calculate the years, months, days, hours, minuets, seconds between 2 dates and quickly realized that between leap years and other factors, rolling my own solution to this problem would be a long process. With that in mind, I went on the hunt for a class written in C# and was either compatible with Windows Phone (WP7) or was written in plain enough C# that I could copy it into a WP7 class and fix any errors.

After looking around and trying a few different solutions, I came across the Time Period Library for .NET written by . Now to be honest, this library is overkill. But because the TimeSpan class included provides exactly what I need, I’m okay with that.

Along with a binary of Time Period Library for .NET, this solution uses some Windows Phone controls from Telerik. Several Telerik controls are used in this solution including RadDatePicker, RadTimePicker and RadDiagnostics. The use of the first 2 are obvious but the 3rd one is used to catch UnhandledExceptions and present the user with the option to send an email to the support email for the application. I use the option to include a Base64 encoded screenshot with the email.

To get the Time Period Library for .NET binary we need, do the following:

  1. Download the source from here.
  2. Unzip the source in a local folder.
  3. Open the “TimePeriod.WindowsPhone.sln” solution.
  4. Make sure the Solutions Configurations is set to “Release”.
  5. Press F6 to build the solution.
  6. Now go back to the folder with the source and open the “Pub” folder.
  7. ┬áIn the “WindowsPhone.Release” folder you will find the “Itenso.TimePeriod.dll” file.

Now you can download the source for my solution. Once you open it, you will need to add references to the following Dlls:

  • Itenso.TimePeriod.dll in the location it built above.
  • Telerik.Windows.Core.dll
  • Telerik.Windows.Controls.Input.dll
  • Telerik.Windows.Controls.Primitives.dll

 

About Adam

Adam Benoit is a Quality Assurance Analyst, Contributing Author and Windows Phone Developer. View all posts by Adam →
This entry was posted in Applications, Development, Featured, Howto. Bookmark the permalink.

Comments are closed.