Windows Phone 7 提醒

编程入门 行业动态 更新时间:2024-10-24 20:22:56
本文介绍了Windows Phone 7 提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

有没有办法按星期几设置提醒?例如,如果我想在每周五上午 10 点收到提醒.

Is there any way to set a reminder by Day of the week? For example if I want a reminder every Friday at 10am.

完成这项任务的最佳方法是什么?

What is the best way to accomplish this task?

我想我一直在考虑某种时间计算.我希望有一种更简单的方式来做我想做的事情.

I think I've been over thinking some sort of hours calculation. I'm hoping there is a more simplistic way of doing what I'm looking to do.

更新:

我的问题更多是关于如何弄清楚如何为特定日期设置提醒,即使不是今天.假设今天是星期三,我想为每个星期五(或一周中的任何一天)设置提醒...我将如何实现?

My question is more about how to figure out how to set the reminder for a specific day even if it isn't today. So lets say today is Wednesday and I want to set a reminder for every Friday (or ANY day of the week)... How would I accomplish that?

推荐答案

因为提醒需要一个 DateTime,所以它很容易.每个应用程序最多有 50 个提醒:

Since the reminder needs a DateTime its pretty easy. Each application has a max of 50 reminders:

DateTime dateTime = DateTime.Now; //First Friday at 10am
for (int i = 0; i < 50; i++)
{
    Reminder reminder = new Reminder("MyReminder")
    reminder.Content = "Reminder";
    reminder.BeginTime = dateTime.AddDays(i * 7);

    ScheduledActionService.Add(reminder);
}

-或者这可能有效-

Reminder reminder = new Reminder("MyReminder")
reminder.Content = "Reminder";
reminder.BeginTime = DateTime.Now; //First Friday at 10am
reminder.Content = "Reminder";
reminder.ExpirationTime = DateTime.Now.AddDays(52 * 7);
reminder.RecurrenceType = RecurrenceInterval.Weekly; 

ScheduledActionService.Add(reminder);

编辑

这就是你如何获得下一个星期几

private DateTime GetNextDay(string dayOfWeek)
{
    for (int i = 0; i < 7; i++)
    {
        DateTime currentDateTime = DateTime.Now.AddDays(i);
        if (dayOfWeek.Equals(currentDateTime.ToString("dddd")))
            return currentDateTime;
    }

    return DateTime.Now;
}

这篇关于Windows Phone 7 提醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:37:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117742.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Windows   Phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!