private async void Btn_plus_time_Clicked(object sender, EventArgs e) { Time_pick.TextChanged -= Time_pick_TextChanged; var btn = (TagButton)sender; await btn.FadeTo(0, 10); TagButton tb = (TagButton)sender; if (Time_pick.Text == "") { Time_pick.Text = "00:00:00"; } string val = Time_pick.Text; double[] form_val = new double[3]; form_val[0] = Convert.ToDouble(val.Split(':')[0]); form_val[1] = Convert.ToDouble(val.Split(':')[1]); form_val[2] = Convert.ToDouble(val.Split(':')[2]); Time_r tm = new Time_r(form_val[0], form_val[1], form_val[2]); switch (tb.Tag) { case "++": tm.Min += 10; break; case "--": if (tm.Min < 10) { tm.Min = 0; } else { tm.Min -= 10; } break; case "+": tm.Sec += 10; break; case "-": if (tm.Sec < 10) { tm.Sec = 0; } else { tm.Sec -= 10; } break; } if (tm.Sec >= 359999) { tm.Sec = 359999; } Time_pick.Text = tm.ToString(); Time_pick.TextChanged += Time_pick_TextChanged; await btn.FadeTo(1, 100); }
private void Time_pick_TextChanged(object sender, TextChangedEventArgs e) { string val = Time_pick.Text; double[] form_val = new double[3]; form_val[0] = Convert.ToDouble(val.Split(':')[0]); form_val[1] = Convert.ToDouble(val.Split(':')[1]); form_val[2] = Convert.ToDouble(val.Split(':')[2]); Time_r tm = new Time_r(form_val[0], form_val[1], form_val[2]); if (tm.Sec >= 359999) { tm.Sec = 359999; } val = tm.ToString(); Time_pick.Text = val; }