Пример #1
0
        public Task StopAsync(bool willContinue = false)
        {
            if (SelectedActivity == null)
            {
                return(Task.Factory.StartNew(delegate { }));
            }

            if (!willContinue)
            {
                SelectedActivity.IsRecording = false;
                SelectedActivity.EndDate     = DateTime.Now;
                SelectedActivity.State       = Enumerations.ActivityState.Completed;
                ActiveActivity = null;
            }
            _timer.Stop();
            RecordingChanged?.Invoke(this, EventArgs.Empty);
            return(_assignmentService.SaveActivityAsync(SelectedActivity));
        }
Пример #2
0
 public Task RecordAsync()
 {
     if (SelectedActivity == null)
     {
         return(Task.Factory.StartNew(delegate { }));
     }
     SelectedAssignment.Status    = Enumerations.AssignmentStatus.Active;
     SelectedActivity.IsRecording = true;
     if (SelectedActivity.StartDate == DateTime.MinValue)
     {
         SelectedActivity.StartDate = DateTime.Now;
     }
     SelectedActivity.State = Enumerations.ActivityState.Active;
     ActiveActivity         = SelectedActivity;
     _timer.Start();
     RecordingChanged?.Invoke(this, EventArgs.Empty);
     return(_assignmentService.SaveActivityAsync(SelectedActivity));
 }