2016-12-06 66 views
0

的Visual Studio 2012 - Windows 8的Metro應用。我已經實現定時器在我的應用程序來顯示當前時間。它工作正常下面的代碼定時器時鐘最小化應用程序後不滴答作響 - Windows 8的Metro應用

ThreadPoolTimer.CreatePeriodicTimer(async (timer) => 
      { 
       this.Dispatcher.RunAsync(CoreDispatcherPriority.Low, 
       () => 
       { 
        this.tbDigitalClock.Text = DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm") + " UTC"; 
       }); 
      }, TimeSpan.FromSeconds(60)); 

最小化,並等待5分鐘&最大化應用程序窗口後。我能注意到,相比於當前的時間當在應用上的時間小於5分鐘。

不知道爲什麼會出現這個時間差。難道是後臺線程無法綁定UI元素時,UI是無效的?

注:這是在Windows 10工作正常,但在Windows 8

回答

0

從低製作CoreDispatcherPriority到正常工作不使它在Windows 8中正常工作。

CoreDispatcherPriority.Normal

相關問題