Esempio n. 1
0
        public void OnDownloadCompleted(DownloadResult result)
        {
            if (result == DownloadResult.Incomplete)
            {
                _downloadService.Cancel();
            }

            _downloadService.Completed       -= OnDownloadCompleted;
            _downloadService.ProgressChanged -= OnDownloadProgressChanged;
        }
Esempio n. 2
0
 public void Cancel()
 {
     if (_windowManager.ShowMessageBox("${WhetherCancelDownload}", "${CancelDownload}",
                                       MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         _downloadService.Cancel();
     }
 }
Esempio n. 3
0
 private void uxCancelButton_Click(object sender, EventArgs e)
 {
     DownloadService.Cancel();
     if (uxCancelButton.Text != PCResource.LaunchButtongText)
     {
         CancelDownload = true;
     }
     this.Close();
 }
Esempio n. 4
0
        protected override void OnViewLoaded()
        {
            var window = this.View as Window;

            window.Closing += (sender, e) =>
            {
                if (IsDownloading && this.IsActive)
                {
                    if (_windowManager.ShowMessageBox("${WhetherCancelUpdate}", "${CancelUpdate}",
                                                      MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        _downloadService.Cancel();
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            };
        }
Esempio n. 5
0
        public void Setup(UpdateInfo info)
        {
            var download = _updateService.GetDownload(info);

            _downloadService = new DownloadService(download);

            _downloadService.ProgressChanged += progress =>
            {
                DownloadProgress = (double)progress.DownloadedBytes / progress.TotalBytes;
                Percentage       = (DownloadProgress * 100.0).ToString("0.0") + '%';
            };

            _downloadService.Completed += result =>
            {
                if (result == DownloadResult.Incomplete)
                {
                    _downloadService.Cancel();
                }
            };

            IsDownloading = false;

            DisplayUpdateInfo(info);
        }