Wednesday 15 May 2013

c# - why begintime in alarm should not be DateTime.Now? -


I was an exception when making an app using an alarm but unfortunately I did not know the answer. Alarm = New Alarms (Title Box. Text); //alarm.BeginTime = DateTime.Now; Alarm.BeginTime = DateTime.Now.AddSeconds (5); Alarm. Resource = "Alarm set for note. Please check it now."; Alarm. End time = end time; Alarm. Repetition type = recurrence interval.No; IsAlaramOn = True; ScheduledActionService.Add (alarm);

An exception occurs when the start time is datetime. Now? Why do I need to add a few seconds?

Although I'm not familiar with Windows Phone 7 development, I think, logically, Alarms will not accept the current time because the code running at the time starts from the alarm time, even some milliseconds.

If you think about it, then the computer thinks in an era, not in hour / minute / second. Therefore, even if a millisecond pass, because the alarm was set to "now", then the alarm is past.

Microsoft developers have set up an alarm class for this alarm, the alarm is set to "now", due to that discrepancy, possibly because the alarm will not fire retro (if this fire If a fire has been set in the past, then it is necessary to provide them for determining if this happens, for very little profit.)

Again, though, I'm not familiar with Windows Phone 7 Platforms If one has the contrary, please contribute!

No comments:

Post a Comment