问题
Is there a way to my C# winforms application knows when Date and time settings has changed on local computer.
回答1:
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.
回答2:
I think SystemEvents.TimeChanged is what you are looking for.
来源:https://stackoverflow.com/questions/3787299/subscribe-to-event-of-changing-time-on-local-system