You can use: Device.StartTimer
Syntax:
public static void StartTimer (TimeSpan interval, Func<bool> callback)
Examples: increment number every 1 second for 1 minute
int number = 0; Device.StartTimer(TimeSpan.FromSeconds(1),() => { number++; if(number <= 60) { return true; //continue } return false ; //not continue });
Examples: wait 5 seconds to run the function once
Device.StartTimer(TimeSpan.FromSeconds(5),() => { DoSomething(); return false ; //not continue });
source share