When developing Smartphone/pocket PC applications with. NET CF, we often need to add reminders to our applications, such as alerting users to meetings at two o'clock in the afternoon, or alerting users to synchronizing an important data while the handheld device and PC are connected via ActiveSync. Currently, there are several ways to implement reminders:
Windows CE. NET provides an API for Cesetusernotification (CE version 2.11 and Cesetusernotificationex) that can be used to create or modify reminders. This method applies to smartphone and Pocket PCs.
Windows CE. NET also provides another piece of api,shnotificationadd that can be done with reminders. This reminder is displayed as a bubble in the Pocket pc and is not processed on the smartphone.
Windows CE. NET is built into Pocket Outlook and provides Poom (Pocket Outlook Object Model) for two development. This method applies to smartphone and Pocket PCs.
All three of these methods are used in varying degrees to use platform invoke (Platform invoke) or COM interop, which is highly technical to the developer and is not conducive to increased development speed. Therefore, proper encapsulation is very necessary. Fortunately, at present opennetcf.org (http://www.opennetcf.org) has completed the first two tasks, developed in OpenNETCF and released free of the SDF (Smart Device Framework) has already encapsulated the first two APIs into the managed API, which greatly reduces the developer's two development difficulties. At the same time, Inthehand Company (http://www.inthehand.com) also offers a very good component--pocket Outlook, which encapsulates the underlying COM interop with managed code, allowing developers to lay out the underlying details of the trivial Take it off. However, the Inthehand component is available for free beta only, and costs are required for use in a business environment.
Below I have a series of examples to illustrate the application of the above several methods.
1. OpenNETCF.Win32.Notify
The opennetcf.org encapsulates the cesetusernotification (and a corresponding set of APIs) in the OpenNETCF.Win32.Notify namespace of the SDF, using only a few lines of code to implement simple reminders, as in the following example , you can set up a reminder dialog box that pops up after 1 minutes on Smartphone/pocket PC 2003 (You need to add a reference to OpenNETCF.dll):
UserNotification notification = new UserNotification();
notification.Action = NotificationAction.Dialog;
notification.Title = "我的提醒";
notification.Text = "别忘 了锻炼!";
Notify.SetUserNotification("", DateTime.Now.AddMinutes(1), notification);
The implementation effect is as follows:
The effect of applying OpenNETCF.Win32.Notify on graph 1:smartphone
Figure 2:pocket The effect of applying OpenNETCF.Win32.Notify on a PC