0
我想創建一個倒數計時器內將在我的應用程序的用戶界面中更新的線程。 我有一個問題,使用參考`System.Threading.Thread。Xamarin表單UI線程不工作
using System.Globalization;
using System.Threading;
new System.Threading.Thread(new System.Threading.ThreadStart(() =>
{
InvokeOnMainThread(() =>
{
this.timer1 = this.timer1.AddDays(16);
this.timer1 = this.timer1.AddMonths(10);
this.timer1 = this.timer1.AddYears(2015);
this.timer2 = DateTime.Now;
this.result = this.timer1.Subtract(this.timer2);
nbJour = this.result.Days.ToString();
nbHeure = this.result.Hours.ToString();
nbMin = this.result.Minutes.ToString();
});
})).Start();
Thread
和ThreadStart()
有下劃線的紅色,與沒有錯誤消息。