Example #1
0
        public void CancelDownloads()
        {
            AreDownloadStartpossible = true;
            AreDownloadDetailsShown  = false;

            Downloads
            .Select(x => x)
            .Where(x => x.Download.State == CurrentDownloadState.Download || x.Download.State == CurrentDownloadState.Pause)
            .ToList()
            .ForEach(x => x.CancelDownload());

            foreach (var downloadViewModel in Downloads)
            {
                if (downloadViewModel.Download.State == CurrentDownloadState.Cancel)
                {
                    downloadViewModel.DownloadComplete        -= DownloadComplete;
                    downloadViewModel.DownloadProgressChanged -= DownloadProgressChanged;
                    downloadViewModel.DownloadCancel          -= ShowCancelDialoge;
                    downloadViewModel.DownloadPause           -= ShowPauseDialoge;
                }
            }

            SetTotalFilesProgress();
        }
Example #2
0
 private void DownloadProgressChanged(object sender, MyDownloadEventArgs eventArgs)
 {
     TotalDownloadSpeed = +Downloads.Select(x => x)
                          .Where(x => x.Download.State == CurrentDownloadState.Download)
                          .Select(x => x.GetBytesPerSecondAsUnit()).Sum();
 }