Sunday, December 26, 2010

Calendar Control for Windows Phone 7 (WP7)

For my first WP7 application, Diabetes Manager, I needed a calendar control that would give users an easy way to enter their daily data. Unfortunately WP7 does not provide any calendar control; it does provide a Date and Time picker. But the picker control did not work for me as far as user experience is concerned. And since I did not find anything on the internet, I decided to write my own.

My calendar control gives users a view of the entire month and  they can click on any day to enter data for that day. The control is made up of two sections :

a) Month and Year selector at the top and
b) Grid of days at the bottom.

Users can navigate between months by clicking on left/right buttons and selecting a day would launch a data entry form.
The calendar control also provides visual cues via color scheme. For instance dates with no data are indicated with default white color; whereas dates with data are indicated with yellow color. Current date is indicated by Orange color.
The rounded rectangles are achieved by using a combination of Rectangle Shape with rounded borders and transparent button (which makes it click able).

IMPORTANT:  To display the different color schemes (white, yellow, orange) for different states, I initially set the Foreground property of the Button. But it would always revert back to the original color (White in this case). The workaround is to define button styles for various states in XAML as shown here http://pastie.org/1407164 and use it in the code as follows:

btn.Style = this.Resources["HasDataButtonStyle"] as Style;


I posted the entire source code for this control on Codeplex: http://calendarcontrolwp7.codeplex.com/releases/view/58137

Monday, November 29, 2010

My first Windows Phone 7 App

Diabetes Manager is my first Windows Phone 7 App. It allows users to set target, track their daily blood glucose levels and also monitor progress.

WP7: Diabetes Manager App from Collective Wisdom on Vimeo.

Friday, September 10, 2010

Using WinDBG to debug .NET 2.0+ applications

To analyze memory dumps of applications using .NET 2.0 and above use the following command:
".loadby sos mscorwks"

This command loads SOS for .NET Framework 2.0.

WinDBG/SOS Cheat Sheet

Update 06/10/2011:

For .NET 4 use ".loadby sos clr"
(source : http://stackoverflow.com/questions/4373683/unable-to-load-sos-in-windbg)

Friday, September 03, 2010

WCF InstanceManagement Summary



In WCF, the service instance is a product of binding, contract configuration (SessionMode property on ServiceContract) and service behavior (InstanceContextMode on ServiceBehavior).

The following table summarizes this:

BindingServiceContractAttribute.SessionModeInstanceContextModeAsync Dispose()Service Instance Mode

(behavior of service instance)
BasicHttpAllowed/NotAllowedPerCall/PerSessionYesPerCall
TCP, IPCAllowed/RequiredPerCallNoPerCall
TCP,IPCAllowed/RequiredPerSessionYesPerSession
WS (no security,no reliability)Allowed/NotAllowedPerCall/PerSessionYesPerCall
WS (with security or reliability)Allowed/RequiredPerSessionYesPerSession
WS (with security or reliability)NotAllowed (setting valid because WS implements application level session)PerCall/PerSessionYesPerCall