Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SystemState CalendarAppointment Events Seem Very Broken

2 views
Skip to first unread message

jonfroehlich

unread,
Aug 28, 2006, 9:09:50 PM8/28/06
to
For the most part, I've had good experiences with the new
Microsoft.WindowsMobile.Status.SystemState infrastructure in .NET CF
2.0. However, recently I've run up against numerous issues with the
CalendarAppointment* and CalendarNextAppointment* events. Incidentally,
I've tested this on the I-Mate KJAM Pocket PC Phone as well as the
Cingular 2125, T-Mobile SDA, and the I-Mate SP5m SmartPhones. It
shouldn't be too hard to repo what I'm describing on your own device.

I will describe the problems in descending importance:

1. The SystemState calendar related events do not properly notify
subscribers when the calendar appointment state changes. My impression
of these system states is that an event will be fired throughout the
day as a user's calendar appointments occur. I would say that in more
than 90% of the cases, no event is triggered. I haven't been able to
diagnose exactly why this is. The problem I'm describing here seems
relevant for all calendar related events. For example,

private SystemState _stateCalendarAppointmentBusyStatus;

private void Init()
{
_stateCalendarAppointmentBusyStatus = new
SystemState(SystemProperty.CalendarAppointmentBusyStatus, true);
_stateCalendarAppointmentBusyStatus.Changed += new
ChangeEventHandler(OnStateCalendarAppointmentBusyStatusChanged);
}

private void OnStateCalendarAppointmentBusyStatusChanged(object sender,
ChangeEventArgs args)
{
AppendText(SystemProperty.CalendarAppointmentBusyStatus,
(BusyStatus)args.NewValue);
}

private void AppendText(SystemProperty systemProperty, object newValue)
{
_textBox.Text += systemProperty + ": " + newValue + "\r\n";
}

Just to add a little more feedback on this (at the risk of muddling my
point). I do actually tend to see events fire if I go in and modify the
_current_ calendar entry. For example, if it's 4:15PM and I change my
current calendar appointment (which occurs from 4-5:00PM) from "Busy"
to "Out of Office", a calendar related event (e.g., CalendarAppointment
or CalendarAppointmentBusyStatus) will fire. However, if it's 3:59PM
and my current calendar entry says that I am "Free" then at 4:00PM,
when you would expect my 4 o'clock appointment event to trigger an
event, nothing happens :(

2. At this point, I thought perhaps I misunderstood what the current
calendar appointment events did particularly because I seemed to get
events when I would go into the calendar and modify the current
appointment. However, this isn't the issue. I setup a polling sensor
that would, instead of relying on the events, constantly poll the
calendar related system states. You can do this because calling
SystemState.CalendarAppointment, for example, returns the current value
of that system state. However, what I found through polling was that
this system state was not actually changing. To test this out, setup a
"refresh" button in your GUI or run a windows Timer object to spit out
the current state of the CalendarAppointment* system states. Then, add
5 or 6 test appointments to your calendar that will occur over the
course of the next 10 minutes. You'll note that the states don't
actually change with the calendar appointments. I've found that the
CalendarAppointment* and CalendarNextAppointment* seem to be
particularly troublesome while CalendarHomeScreenAppointment* stuff
works a little more frequently (though these events are much less
useful to us).

3. Going back to using the system state events. Interestingly, the
following code will sometimes throw a NullReferenceException because
the args object passed in is null. Perhaps this makes sense--if the
current appointment is deleted the BusyStatus switches from a known
state to a null state--however, this is underdocumented. An unsavvy
programmer could easily fail to null check the ChangeEventArgs
argument.

private void OnStateCalendarAppointmentBusyStatusChanged(object sender,
ChangeEventArgs args)
{
AppendText(SystemProperty.CalendarAppointmentBusyStatus,
(BusyStatus)args.NewValue);
}

Hopefully someone at MS has the patience to read through this whole
post and respond. If you made it this far, thanks!

Jon

0 new messages