订阅在本地系统上更改时间的事件 [英] Subscribe to event of changing time on local system
本文介绍了订阅在本地系统上更改时间的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
是的,我的C#winforms应用程序知道何时日期和时间设置在本地计算机上更改。 ,您要查看 SystemEvents.TimeChanged 。
Microsoft.Win32.SystemEvents.TimeChanged + =
/ pre>
new EventHandler(SystemEvents_TimeChanged);
void SystemEvents_TimeChanged(object sender,EventArgs e)
{
//系统时间更改
}
从文档中:
当用户更改时间时发生
在系统时钟。
Is there a way to my C# winforms application knows when Date and time settings has changed on local computer.
解决方案Yes, you want to take a look at SystemEvents.TimeChanged.
Microsoft.Win32.SystemEvents.TimeChanged += new EventHandler(SystemEvents_TimeChanged); void SystemEvents_TimeChanged(object sender, EventArgs e) { // The system time was changed }
From the documentation:
Occurs when the user changes the time on the system clock.
这篇关于订阅在本地系统上更改时间的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文