c# - Xamarin Forms UI Thread not working -


i trying create countdown timer inside thread updated in ui of application. have problem using reference `system.threading.thread.

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() underlined red, no error message.

use device.begininvokeonmainthread instead of invokeonmainthread or use task.

device.begininvokeonmainthread( () => { ... } ); 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -