Over a million developers have joined DZone.

Windows Phone App: Age Tracker(Source Code)

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

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 use.

Before we go further, here's the source code:



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.

Birth time is optional. If not used, midnight on the birth date is used.

Share with Facebook, MSN Live and Twitter using the accounts you already have setup by tapping the ‘share’ button in the bottom menu.

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

Age Tracker

99 blue
Price: FREE

Age Tracker is a simple way to keep track of your age and the ages of 2 others.

Set names and birthdates in the settings found in the menu (…) on bottom of the screen.

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.


Published at DZone with permission of Adam Benoit, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}