The opinions expressed herein are my own personal opinions. They are not necessarily fact or sactioned by any other person or organization. If you disagree that's your right. It's also my right to not care.
© Copyright 2008, Chris Tacke
The Windows CE operating system supports several notifications for common device events liek changes in AC power, network status changes and time changes. They are exposed by using the CeRunAppAtEvent or CeSetUserNotification APIs. While the Windows Mobile Notification Broker provides an interface for some of these, it doesn't provide access to all of them, nor is it available for general Windows CE developers.
SDF 1.4 provided a set of Notification classes that could be used to get these (and those classes are still there in SDF 2.0) but we felt that a simple object model around these would really be a nice thing to have. So we created the OpenNETCF.WindowsCE.DeviceManagement class. Now subscribing to the notifications is as simple as this example of detecting when the device time has been modified:
using
namespace
public class MyClass{ public MyClass(){ DeviceManagement.TimeChanged += new DeviceNotification(DeviceManagement_TimeChanged);}void DeviceManagement_TimeChanged(){ MessageBox.Show("The time was just changed.");} }
public class MyClass{
public MyClass(){ DeviceManagement.TimeChanged += new DeviceNotification(DeviceManagement_TimeChanged);}void DeviceManagement_TimeChanged(){ MessageBox.Show("The time was just changed.");}
}
Remember Me