Exemplo n.º 1
0
 public T Leave <T>(
     Exception?exception, TimeSpan elapsed, Func <TimeSpan, ActionStats, T> map)
 {
     lock (this)
     {
         if (exception != null)
         {
             TotalFailed++;
         }
         TotalCalls++;
         TotalTime = TotalTime.Add(elapsed);
         var result = map(elapsed, this);
         ConcurrentCalls--;
         return(result);
     }
 }
Exemplo n.º 2
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     if (exercisePosition == Exercises.list.Length - 1)
     {
         timer.Stop();
         return;
     }
     if (Counter == 30)
     {
         Counter = 0;
         exercisePosition++;
         Exercise     = Exercises.list[exercisePosition];
         NextExercise = exercisePosition == Exercises.list.Length - 1 ? "Конец" : Exercises.list[exercisePosition + 1];
     }
     TotalTime = TotalTime.Add(TimeSpan.FromSeconds(1));
     Counter++;
 }
Exemplo n.º 3
0
        public void AccumulateTime()
        {
            TimeFromLaunched = TimeFromLaunched.Add(TimeSpan.FromSeconds(Settings.CountingSecondsInterval));

            //指定した時間が経過していたら、データの記録を開始
            if (TimeFromLaunched.TotalSeconds >= Settings.MinCountStartTime)
            {
                if (!IsCountStarted)
                {
                    TotalTime      = TotalTime.Add(TimeSpan.FromSeconds(Settings.MinCountStartTime));
                    IsCountStarted = true;
                }
                else
                {
                    TotalTime = TotalTime.Add(TimeSpan.FromSeconds(Settings.CountingSecondsInterval));
                }
            }
        }
Exemplo n.º 4
0
        private async void Tick()
        {
            UpdateShuttle();

            _logger.LogDebug($"Total Time: {TotalTime}");
            _logger.LogDebug($"Time Left: {CurrentShuttleTimeLeft}");

            PercentageRemaingInCurrentLevel =
                (CurrentShuttleTimeLeft.TotalSeconds /
                 (CurrentShuttle.CommulativeTime - CurrentShuttle.StartTime)
                 .TotalSeconds) * 100;

            TotalTime = TotalTime.Add(new TimeSpan(0, 0, 1));
            CurrentShuttleTimeLeft = CurrentShuttleTimeLeft.Add(new TimeSpan(0, 0, -1));

            if (CurrentShuttleTimeLeft < new TimeSpan(0, 0, -1))
            {
                EndTest();
            }
            await InvokeAsync(StateHasChanged);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the time to the total time spent on activities.
 /// </summary>
 /// <param name="time">The time to add.</param>
 public void AddTime(TimeSpan time)
 {
     TotalTime = TotalTime.Add(time);
 }