Example #1
0
        public void Start()
        {
            ClearHistory();
            if (DurationInSeconds > 0)
            {
                var timerState = new TimerState {
                    SecondsRemaining = DurationInSeconds
                };
                using var timer = new Timer(
                          callback: new TimerCallback(TimerTask),
                          state: timerState,
                          dueTime: 1000,
                          period: 1000);
                ShowProgressBar();
                while (timerState.SecondsRemaining >= 0 && !isStopped)
                {
                    Task.Delay(1000).Wait();
                    UpdateProgressBar(timerState.SecondsRemaining);
                }
            }

            ShowCompleted();
            TaskbarProgress.SetState(TaskbarProgress.TaskbarState.NoProgress);
        }
Example #2
0
 public ToastProgressBar(ISayService sayService, int durationInSeconds)
 {
     this.sayService   = sayService;
     DurationInSeconds = durationInSeconds;
     TaskbarProgress.SetState(TaskbarState.Normal);
 }