Hello,
You can replace DispathTimer with the following code equivalent via Timer.
private Timer _timer;
protected override void OnAppearing()
{
base.OnAppearing();
MainThread.BeginInvokeOnMainThread(() =>
{
SetIndicatorStatus();
SetTimer();
});
if (_timer == null)
{
_timer = new System.Threading.Timer(TimerFunction,null,0, 30000);
}
}
private void TimerFunction(Object stateInfo)
{
MainThread.BeginInvokeOnMainThread(() =>
{
SetIndicatorStatus();
SetTimer();
});
}
protected override void OnDisappearing()
{
base.OnDisappearing();
if (_timer != null)
{
_timer.Dispose();
}
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.