SDF Sample: Detecting device time and time zone changes

Problem
My Appllication needs to detect when the time of timezone has been changed on the device.  It needs to work if the user changes it manually or if something else, such as a time server sync, ActiveSync or DST adjustment, changes it.  What can the SDF do for me?


Solution
The OpenNETCF.WindowsCE.DeviceManagement class provides events for these, as well as many other device notifications.


using OpenNETCF.WindowsCE;

void
TimeOrTZChanged()
{
    MessageBox.Show(“Device time has been altered”);
}

void MyForm()
{

    InitializeComponents();
   
DeviceManagement.TimeChanged += TimeOrTZChanged;
    DeviceManagement.TimeZoneChanged += TimeOrTZChanged;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s