1

I have a WPF applciation running on say PC-1, when time zone is changed in PC-1, the application display a notification saying time zone changed and restarts the application. The problem is when PC-2 takes remote Connection of PC-1, the times-changed event is fired, but it should not.?Why does this happen and how to avoid it.?

  • Why does the application need to restart? Are you doing this to clear memory problems or some other Band-Aid fix? – Kevin Cook Sep 04 '18 at 12:35
  • Is the event being registered in the constructor or load event? The Timezone setting has to be set when the connection is made because it goes from null to a valid TimeZone. – jdweng Sep 04 '18 at 12:36
  • Local networks normally have a designated time provider, typically a server that all PCs on the network synchronize to. Pretty important to get all of them agree about the time of day. Seems you triggered such a synchronization event. Ask a question about it at serverfault.com – Hans Passant Sep 04 '18 at 12:41
  • @KevinCook : the application has some timiings, which need to be set according to the time zone.Hence a restart. – Sainath Naik Sep 05 '18 at 04:14
  • @jdweng: yes the event is fired in the constructor. do i have to change it? – Sainath Naik Sep 05 '18 at 04:15
  • You can add code to ignore event when called from the constructor.Normally I set a Boolean property 'first' in the class initially to true which get set in the default constructor. Then in the event handler test if 'first' equals true. If true do nothing except set first to false. – jdweng Sep 05 '18 at 07:10

0 Answers0