public TimePicker() { mTimePicker = new Microsoft.Phone.Controls.TimePicker(); CurrentHour = 0; CurrentMinute = 0; View = mTimePicker; mTimePicker.ValueChanged += new EventHandler<Microsoft.Phone.Controls.DateTimeValueChangedEventArgs>( delegate(object sender, Microsoft.Phone.Controls.DateTimeValueChangedEventArgs args) { Memory eventData = new Memory(16); const int MAWidgetEventData_eventType = 0; const int MAWidgetEventData_widgetHandle = 4; const int MAWidgetEventDate_value_hours = 8; const int MAWidgetEventDate_value_minutes = 12; eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_TIME_PICKER_VALUE_CHANGED); eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle); eventData.WriteInt32(MAWidgetEventDate_value_hours, mTimePicker.Value.Value.Hour); eventData.WriteInt32(MAWidgetEventDate_value_minutes, mTimePicker.Value.Value.Minute); mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData); }); }