/// <summary> /// Pause all agent tasks safely. /// </summary> internal void Pause() { if (CurrentPacakge == null || CurrentPacakge.State != PackageState.Downloading) { return; } CurrentPacakge.State = PackageState.Paused; ParentDownloder.State = DownloaderState.Paused; DownloadSpeedTracker.Stop(); ParentDownloder.CallDownloadPause(); }
/// <summary> /// Stops all agent tasks safely. /// </summary> internal void Stop(bool forceStop = false) { if (forceStop == false) { if (CurrentPacakge == null || (CurrentPacakge.State != PackageState.Downloading && CurrentPacakge.State != PackageState.Paused)) { return; } } CurrentPacakge.State = PackageState.Canceled; ParentDownloder.State = DownloaderState.Stopped; State = AgentState.Canceled; DownloadSpeedTracker.Stop(); ParentDownloder.CallDownloadStop(); }