How to get tasks which windows mobile reminds you about?
In windows mobile, if you create a task, you can set a开发者_C百科 due date and a time to remind you about the task.
When the time is ready to remind you about the task, windows mobile will play a sound and show a user notification, which persists until you dismiss it.
Now I'd like to know if any task (how many?) has run into this "remind me" stage.
My first try was SystemState.TasksOverdue, but these are not the tasks the system reminds you about, these are the tasks which missed their due-date, which is something different. Same about the other SystemSta.Tasks... properties: none of them is about tasks which the system wants to remind you about.
Is there any way to get the tasks the system is actively reminding you right now?
Oh, I program using c# and .Net CF 2.0.
The answer to this question might help, you could try going through the active notifications and see if you can detect which ones are tasks?
I have no experience with this myself, but my guess would be to look at the TaskCollection which returns a list of current tasks. By looping through that you can look at the ReminderSet, ReminderTime and StartDate properties of the Task class to determine which tasks are currently in the 'reminding stage'.
int activeRemindingTasks = 0;
OutlookSession session = new OutlookSession();
for (Task t in session.Tasks.Items)
{
if (t.ReminderSet && t.ReminderTime <= DateTime.Now)
{
activeRemindingTasks++;
}
}
The only thing I don't know is what happens when a user dismisses the reminders, rather than snoozing them. I assume that the ReminderSet or ReminderRepeat property of the Task object will then return false, but you'll have to check if that is what happens.
You use the CeSetUserNotficiationEx API. I'm not sure if there is a C# version of this API, but you should be able to P/Invoke it easy enough.
Another way is to use the CeRunAppAtTime to run/notify your app of the event and to display the notification yourself. You could then use the more fancy SHNotificationAdd API. The SHNotificationAdd is only available on ppc devices (Touch Screen).
Sorry, I misread the question so my answer is not correct.
精彩评论