当日期时间在C#中快速更改通知 [英] Getting notified when the datetime changes in c#

查看:146
本文介绍了当日期时间在C#中快速更改通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我试图让这将显示当前的年 - 月 - 日给用户的日历应用程序。问题是,如果用户要保持我的应用程序,即使是第二天运行,我怎么得到通知?我该如何更改显示的日期吗?我不想轮询当前日期来更新它。这是可能在C#。

Recently I was trying to make a calendar application that will display the current year-month-date to the user. The problem is, if the user is gonna keep my application running even for the next day, how do I get notified ?? How shall I change the date displayed ? I don't wanna poll the current date to update it. Is this possible in c#.

请注意:我尝试了在 SystemEvent.TimeChanged 事件,但它只能如果用户手动从控制面板更改时间/日期

Note: I tried out the SystemEvent.TimeChanged event, but it works only if the user manually changes the time / date from the control panel.

推荐答案

你能简单地制定出的秒数,直到午夜,然后睡了那么久吗?

Can you simply work out the number of seconds until midnight, and then sleep for that long?

这篇关于当日期时间在C#中快速更改通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆