I am creating a timer which is working on a picker selection changed.Timer is working good until the times end to the "00:00:00".If i change the selection changed in the mid of time then the speed of timer is increased and if i again change selected index than timer run much fast. My problem is that timer should run on 1 sec dealy every time.
I am sharing my code below. Thanks in advance for help.
private async void GName_SelectedIndexChanged(object sender, EventArgs e) { lblEndTime.Text = "00:00:10"; StartTimmer(); } public void StartTimmer() { Device.StartTimer(TimeSpan.FromSeconds(1), () => { Device.BeginInvokeOnMainThread(() => { TimeSpan timeSpan = TimeSpan.Parse(lblEndTime.Text); timeSpan -= TimeSpan.FromSeconds(1); if (lblEndTime.Text == "00:00:00") { returnValue = false; } else { lblEndTime.Text = Convert.ToString(timeSpan); } }); return returnValue; }); }