50个报警限制
本文关键字:50个 | 更新日期: 2023-09-27 18:10:57
我正在开发一个应用程序在windows手机v8。它需要添加60个警报(每天2个警报),但MSDN文章中描述的限制是50个警报在按钮上单击我必须创建所有60个警报上循环,或者我可以添加10个警报,当最后一个警报开始或结束时,可以添加10多个警报。我已经找过了,但没有找到任何解决办法。当警报对话框打开或警报启动时是否有任何事件,也许我可以检查警报是否为最后一次,然后我可以添加10多个警报并删除或更换以前的警报。有什么建议吗?这是我的代码
QList的值取自数据库
for (int i = 0; i < QList.Count; i++)
{
//double seconds = 60.0 * (double)i;
string alarmName = "Sehar Alert " + i.ToString();
Alarm alarm = new Alarm(alarmName);
alarm.Content = "Its Sehar time in " + Cityname + " City. " + i.ToString();
var reminder = ScheduledActionService.Find(alarmName);
if (reminder != null)
{
ScheduledActionService.Remove(alarmName);
}
string datetime = QList[i].date +" "+ QList[i].Sehar;
DateTime sherTime = Convert.ToDateTime(datetime);
if (sherTime > sherT)
{
// DateTime seharTime = new DateTime(2014, 6, 10, 10, 12, 0);
alarm.BeginTime = sherTime;// DateTime.Now.AddSeconds(seconds);
alarm.Sound = new Uri("Assets/Sounds/azan1.mp3", UriKind.Relative);
// alarm.ExpirationTime = alarm.BeginTime.AddSeconds(10.0);
alarm.RecurrenceType = RecurrenceInterval.None;
ScheduledActionService.Add(alarm);
}
// Aftar time in Different City
string IftarName = "Iftar Alert " + i.ToString();
Alarm Ifatealarm = new Alarm(IftarName);
Ifatealarm.Content = "Its Aftar time in " + Cityname + " City. " + i.ToString();
var Iftarreminder = ScheduledActionService.Find(IftarName);
if (Iftarreminder != null)
{
ScheduledActionService.Remove(IftarName);
}
string Iftardatetime = QList[i].date + " " + QList[i].Iftar;
DateTime IfTarTime = Convert.ToDateTime(Iftardatetime);
if (IfTarTime > sherT)
{
// DateTime seharTime = new DateTime(2014, 6, 10, 10, 12, 0);
Ifatealarm.BeginTime = sherTime;// DateTime.Now.AddSeconds(seconds);
Ifatealarm.Sound = new Uri("Assets/Sounds/azan1.mp3", UriKind.Relative);
// alarm.ExpirationTime = alarm.BeginTime.AddSeconds(10.0);
Ifatealarm.RecurrenceType = RecurrenceInterval.None;
ScheduledActionService.Add(Ifatealarm);
}
}
在您的App.Xaml.cs
中,您可以订阅您的RootFrame的Obscured
和Unobscured
事件。
RootFrame.Obscured += new EventHandler<ObscuredEventArgs>(RootFrame_Obscured);
RootFrame.Unobscured += new EventHandler(RootFrame_Unobscured);
报警时,RootFrame_Unobscured
放电;在您取消它之后,RootFrame_Obscured
将被解雇。