I am creating a synchronization application in C # .Net. I have images for each digit from 0 to 9. I have a timer in the constructor of the main page that indicates every second
DispatcherTimer tmr = new DispatcherTimer(); tmr.Interval = TimeSpan.FromSeconds(1); tmr.Tick += new EventHandler(tmr_Tick); tmr.Start(); void tmr_Tick(object sender, EventArgs e) { dt = DateTime.Now; UpdateSecondsImages(dt); } private void UpdateSecondsImages(DateTime dt) { secondSource2 = dt.Second % 10; secondDigit2.Source = digimgs[secondSource2]; if (secondSource2 == 0) { secondSource1 = dt.Second / 10; secondDigit1.Source = digimgs[secondSource1]; } if (secondSource1 == 0) { UpdateMinuteImages(dt); } }
But the problem that I am currently facing is that this code may skip a second for a minute. Please suggest an alternative way to make this smooth in terms of performance.
Simple. , : ", 1 , ". . , API- . , , , DateTime.Now.
: , 1.02 . , 50 . , "49,98" ( "49" ), , "51.00".
1 . 500-750 . , . , , , .
: tmr.Interval = TimeSpan.FromMilliSeconds(500);
, , CompositionTarget.Render . UI . , :).
, (cos() sin() ). ( ), .
, .
Yesterday, we launched a contest with Ball Watch USA to create watches in Silverlight. I recommend using the Storyboard to rotate the second hand 360 degrees for 1 minute and set the storyboard permanently. Here are some links:
Source: https://habr.com/ru/post/1748976/More articles:browser compatibility - cross-browserto remove pear in water - phpChecking if the application can work without administrator rights? - windowsIs `std :: string (strerror (errno))` dangerous? - c ++Как продавать несколько приложений, разделяющих vars в App Store? - iphoneDelphi - need example to run COM / OLE - dllReed-Solomon encoder for embedded application (with memory efficiency) - memoryjQuery Clone и добавить строку в последнюю строку - jqueryHow to decode UTF8 characters using JSON on iPhone? - jsonCreate Instante Messenger using XMPP and C # .NET. - c #All Articles