What’s Coming In Mango–Reminders

Mango From Scratch

One of the very cool features coming in Mango is Reminders, and more generally, scheduled tasks. Reminder  This allows you to set up a reminder and then exit the application.  When your reminder fires you have the opportunity to snooze the reminder or to enter the application. And if you enter the application you can enter not only at the home page, but also deep within the application at the relevant page for the reminder.

To get started, let’s strip down an example shown at Mix 11 by  Peter Torr to its absolute essence.  We’ll create a new Mango application and place a button which says “Remind Me” on the main page.  In the code behind, the click event handler for the button creates the Reminder (and passes in a name so that we can, if we choose, refer to the reminder programmatically). 

We then set the title of the reminder, the amount of time to wait for it to show itself (BeginTime) and a Uri for where to return to should the user click on the reminder.  Finally, we register the reminder with the ScheduledActionService which will manage all the reminders and alarms.  Here’s the code for the click event handler,

void Reminder_Click( object sender, RoutedEventArgs e )
{
   Reminder r = new Reminder( "Dinner" );
   r.Title = "Dinner";
   r.Content = "Time to eat dinner";
   r.BeginTime = DateTime.Now.AddSeconds( 10 );
   r.NavigationUri = NavigationService.CurrentSource;
   ScheduledActionService.Add( r );
}

To test the application click the button and then exit the application. About 10 seconds later the reminder will pop up and clicking on it will return you to the original page.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
This entry was posted in Mango, Mini-Tutorial and tagged . Bookmark the permalink.

4 Responses to What’s Coming In Mango–Reminders

Comments are closed.