Esempio n. 1
0
        private void BtStart_Click(object sender, RoutedEventArgs e)
        {
            if (ThereIsInvalidField())
            {
                return;
            }

            ResetPause();

            totalSeconds              = GetSecondsTotal();
            progressBarBomba.Maximum  = totalSeconds;
            RemainingAfterPauseGlobal = totalSeconds;

            WorkerState      = 0;
            aTimerProcessBar = new PausableTimer(1000);
            aTimerProcessBar._isProcessBar = true;
            aTimerProcessBar.Elapsed      += OnTimedEvent;
            aTimerProcessBar.AutoReset     = true;
            aTimerProcessBar.Start();

            aTimerBomba           = new PausableTimer(totalSeconds * 1000);
            aTimerBomba.Elapsed  += OnTimedEvent2;
            aTimerBomba.AutoReset = false;
            aTimerBomba.Start();
        }
Esempio n. 2
0
 private void BtReset_Click(object sender, RoutedEventArgs e)
 {
     if (aTimerProcessBar != null)
     {
         aTimerProcessBar.Stop();
         aTimerBomba.Stop();
         aTimerProcessBar = null;
         aTimerBomba      = null;
         WorkerState      = 0;
         bPaused          = false;
         UpdateTimeView();
         ResetPause();
     }
 }