public override async Task OnNavigateTo(object parameter)
        {
            await base.OnNavigateTo(parameter);

            try
            {
                var session = parameter as EvolveSession;
                if (session != null)
                {
                    IsBusy = true;
                    Session = session;

                    VideoDownload = await _downloadManager.GetDownloadForSessionAsync(Session);
                    if (VideoDownload!=null)
                    {
                        VideoDownload.DownloadCompleted += OnVideoCompleted;
                    }
                  
                }
            }
            catch (Exception ex)
            {
                // TODO: Log error
                await _dialogService.ShowMessageAsync("Error", "Is not possible load the item");
                _navigationService.GoBack();
            }
        }
 private async Task DeleteDownloadAsync()
 {
     try
     {
         if (HasDownload)
         {
             await this._downloadManager.DeleteDownloadAsync(this.VideoDownload);
             this.VideoDownload = null;
         }
     }
     catch (Exception ex)
     {
         await this._logService.LogExceptionAsync(ex);
     }
 }
        private async Task DownloadVideoAsync()
        {
            try
            {
                if (!this._networkService.IsOnline)
                {
                    await this._dialogService.ShowMessageAsync("No internet access", "A network connection is neccessary to download the video");
                    return;
                }

                await _downloadManager.QueueDownloadAsync(Session);
                VideoDownload = await _downloadManager.GetDownloadForSessionAsync(Session);
                if (VideoDownload != null)
                {
                    VideoDownload.DownloadCompleted += OnVideoCompleted;
                }
            }
            catch (Exception ex)
            {
                await _dialogService.ShowMessageAsync("Error", "Is not possible download the video");
                await this._logService.LogExceptionAsync(ex);
            }
        }
Esempio n. 4
0
 public async Task ResumeDownload(IVideoDownload download)
 {
     var selected = Downloads.FirstOrDefault(x => x.Id == download.Id);
     if (selected != null)
     {
         await download.ResumeAsync();
         await this.SaveDownloasdToStorageAsync();
     }
 }
Esempio n. 5
0
 public async Task DeleteDownloadAsync(IVideoDownload download)
 {
     var selected = Downloads.FirstOrDefault(x => x.Id == download.Id);
     if (selected != null)
     {
         await selected.DeleteAsync();
         Downloads.Remove(selected);
         await this.SaveDownloasdToStorageAsync();
     }
 }
Esempio n. 6
0
        private async Task UpdateDownloadsAsync(IVideoDownload download)
        {
            var localDownload = this.Downloads.FirstOrDefault(x => x.Id == download.Id);
            if (localDownload != null)
            {
                ////localDownload.Status = download.Status;
                //localDownload.LocalFileUrl = download.LocalFileUrl;
                ////localDownload.Percentage = download.Percentage;
                //localDownload.SessionId = download.SessionId;

                await SaveDownloasdToStorageAsync();
            }
        }