Example #1
0
        public virtual void Pause(TimeSpan duration)
        {
            //TODO: pause
            var now           = DateTime.Now;
            var nextStartDate = now.AddSeconds(duration.Seconds);

            ScheduledTask.StopSchedule();

            OnPaused?.Invoke(this, new WorkerPausedEventArgs());

            Store($"{Name} has paused at {DateTime.Now}");
        }
Example #2
0
        public virtual bool Stop()
        {
            try
            {
                ScheduledTask.StopSchedule();

                OnStopped?.Invoke(this, new WorkerStoppedEventArgs());

                Store($"{Name} has stopped at {DateTime.Now}");

                return(true);
            }
            catch (Exception exception)
            {
                WorkerLogger.Error("", exception);
                return(false);
            }
        }
Example #3
0
 public void Dispose()
 {
     ScheduledTask.StopSchedule();
 }