Windows Phone appointment task
Posted
by Dennis Vroegop
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Dennis Vroegop
Published on Sun, 10 Aug 2014 06:37:02 GMT
Indexed on
2014/08/18
16:26 UTC
Read the original article
Hit count: 685
WP7DEV
Originally posted on: http://geekswithblogs.net/dvroegop/archive/2014/08/10/windows-phone-appointment-task.aspx
I am currently working on a new version of my AgeInDays app for Windows Phone. This app calculates how old you are in days (or weeks, depending on your preferences). The inspiration for this app came from my father, who once told me he proposed to my mother when she was 1000 weeks old. That left me wondering: how old in weeks or days am I? And being the geek I am, I wrote an app for it. If you have a Windows Phone, you can find it at http://www.windowsphone.com/en-in/store/app/age-in-days/7ed03603-0e00-4214-ad04-ce56773e5dab
A new version of the app was published quite quickly, adding the possibility to mark a date in your agenda when you would have reached a certain age. Of course the logic behind this if extremely simple. Just take a DateTime, populate it with the given date from the DatePicker, then call AddDays(numDays) and voila, you have the date. Now all I had to do was implement a way to store this in the users calendar so he would get a reminder when that date occurred. Luckily, the Windows Phone SDK makes that extremely simple:
public void PublishTask(DateTime occuranceDate, string message)
{
var task = new SaveAppointmentTask()
{
StartTime = occuranceDate,
EndTime = occuranceDate,
Subject = message,
Location = string.Empty,
IsAllDayEvent = true,
Reminder = Reminder.None,
AppointmentStatus = AppointmentStatus.Free
};
task.Show();
}
And that's it. Whenever I call the PublishTask Method an appointment will be made and put in the calendar. Well, not exactly: a template will be made for that appointment and the user will see that template, giving him the option to either discard or save the reminder.
The user can also make changes before submitting this to the calendar: it would be useful to be able to change the text in the agenda and that's exactly what this allows you to do. Now, see at the bottom of the screen the option "Occurs". This tiny field is what this post is about. You cannot set it from the code.
I want to be able to have repeating items in my agenda. Say for instance you're counting down to a certain date, I want to be able to give you that option as well. However, I cannot. The field "occurs" is not part of the Task you create in code.
Of course, you could create a whole series of events yourself. Have the "Occurs" field in your own user interface and make all the appointments. But that's not the same. First, the system doesn't recognize them as part of a series. That means if you want to change the text later on on one of the occurrences it will not ask you if you want to open this one or the whole series. More important however, is that the user has to acknowledge each and every single occurrence and save that into the agenda.
Now, I understand why they implemented the system in such a way that the user has to approve an entry. You don't want apps to automatically fill your agenda with messages such as "Remember to pay for my app!". But why not include the "Occurs" option? The user can still opt out if they see this happening.
I hope an update will fix this soon. But for now: you just have to countdown to your birthday yourself. My app won't support this.
© Geeks with Blogs or respective owner