I am building a Xamarin cross platform app targeting IOS Android and Windows Phone 8.1 using .Net 4.5.1. When I try to reference System.Timers in the PCL project, it is not there. How do I fix this?
You can use : Device.StartTimer
Syntax :
public static void StartTimer (TimeSpan interval, Func<bool> callback)
Examples : increment number every 1 seconds for 1 minutes
int number = 0;
Device.StartTimer(TimeSpan.FromSeconds(1),() => {
number++;
if(number <= 60)
{
return true; //continue
}
return false ; //not continue
});
Examples : wait for 5 seconds to run function one time
Device.StartTimer(TimeSpan.FromSeconds(5),() => {
DoSomething();
return false ; //not continue
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With