private void Timer_Tick(object sender, EventArgs e) { RemainingTime = RemainingTime.Subtract(new TimeSpan(0, 0, 1)); timeDisplayBlock.Text = RemainingTime.ToString(); DoubleAnimation progressAnimation = new DoubleAnimation(progressBar.Value + _increment, new Duration(new TimeSpan(0, 0, 1))); progressBar.BeginAnimation(ProgressBar.ValueProperty, progressAnimation); if (RemainingTime.TotalSeconds == 30) { timeDisplayBlock.Foreground = progressBar.Foreground = new SolidColorBrush(Colors.Red); } if (RemainingTime == TimeSpan.Zero) { SubmitButton_Click(null, null); } }
public void Update(int time = 60) { RemainingTime = RemainingTime.Subtract(TimeSpan.FromSeconds(time)); }
private void FillSlot(TimeSpan talkDuration) { RemainingTime = RemainingTime.Subtract(talkDuration); CurrentSlotPointer = CurrentSlotPointer.Add(talkDuration); }