Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Device.StartTimer problem

$
0
0

Hi
I would highly appreciate if someone could tell me why this code does not work in iOS 7 or 8 where it works perfectly under Android

private void StartTimer()
{
    var countDownTimeSpan = new TimeSpan(0, 5, 0);
    var substractionTimeSpan = new TimeSpan(0, 0, 1);
    try
    {
        Device.StartTimer(substractionTimeSpan, () =>
        {
            countDownTimeSpan = countDownTimeSpan.Subtract(substractionTimeSpan);

            _recordModel.TimeElapsedLabel.Text = String.Format("{0}:{1}", countDownTimeSpan.Minutes,
                        countDownTimeSpan.Seconds);

            if (countDownTimeSpan.Minutes == 0 && countDownTimeSpan.Seconds == 0 || _stop)
            {
                return false;
            }
            else
            {
                return true;
            }
        });
    }
    catch (Exception ex)
    {
        Insights.Report(ex);
        Debug.WriteLine(ex.Message + ": " + ex.StackTrace);
    }
}

Viewing all articles
Browse latest Browse all 58056

Trending Articles