SystemEvent.TimeChanged is fired twice - by tungngie

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 776003 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 1/7/2013 6:27:15 PM
Access Restriction Public

Description

I try to use SystemEvents.TimeChanged event in my desktop Windows application as follow:

SystemEvents.TimeChanged += delegate
{
MessageBox.Show("TimeChanged!");
};

And when I change system time, message box appear twice. 
Why is this so?
Sign in to post a comment.
Posted by Pakojones on 4/13/2015 at 3:55 AM
Thanks to this issue and to the fact that it won't be fixed, the solution I found out is the following:

int timeChangeCount = 0;

        private void OnClockUpdate(object sender, EventArgs e)
        {
            if (timeChangeCount == 1)
            {
                timeChangeCount = 0;
            }
            else
            {
                // Do stuff

                timeChangeCount++;
            }
        }


People invest time and struggle to follow patterns, best practices, and yet, at the end we have to use code like this because Microsoft states that won't fix this issue...
Posted by Microsoft on 1/8/2013 at 1:10 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/7/2013 at 6:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)