gpt4 book ai didi

delphi - 自定义通知间隔

转载 作者:行者123 更新时间:2023-12-02 03:29:18 25 4
gpt4 key购买 nike

我正在 Rad Studio XE8 下的 FireMonkey 中构建一个应用程序。

我想在我的通知上设置自定义间隔 (FMX.Notification)。

但是通知重复只能设置为一定的间隔。

TRepeatInterval = (None, Second, Minute, Hour, Day, Week, Weekday, Month, Quarter, Year, Era);

如果我想每 15 分钟触发一次,我是否真的需要创建四个通知(在 0、15、30、45 分钟)并使用 TRepeatInterval(4) 每小时重复一次?

最佳答案

documentation对于 FMX.Notification.TNotification.RepeatInterval 说,我强调:

If you want to set a custom interval, like for example 30 minutes, you need to create two notifications setting a scheduled difference of 30 minutes with FireDate and set the repeat interval of both notifications to an hour.

你猜对了。您需要创建四个通知并每小时重复一次。


OP 在评论中告诉我,他最终使用了以下代码。我将其包含在我的答案中,以提高他给定信息的可读性。

//Repeat very 5 minutes
//Create 12 notifications fireing every hour with 5 minute intervals Notification.RepeatInterval := TRepeatInterval.Hour;
for I := 0 to 11 do
begin
Notification.FireDate := Notification.FireDate + EncodeTime(0,(I*5),0,0);
ANotificationcenter.ScheduleNotification(Notification);
end;

关于delphi - 自定义通知间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32398552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com