Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
        /// <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();
        }