public async Task <bool> Download() { IsBusy = true; var result = await Novaroma.Helper.RunTask(() => _engine.DownloadSubtitle(_fileInfo.FullName, SelectedResult, _downloadable), _exceptionHandler ); IsBusy = false; return(result); }
public async Task DownloadSubtitle(string filePath) { var downloadable = await _engine.GetDownloadable(filePath); if (downloadable != null) { var downloaded = false; var movie = downloadable as Movie; if (movie != null) { downloaded = await _engine.DownloadSubtitleForMovie(movie); } else { var episode = downloadable as TvShowEpisode; if (episode != null) { downloaded = await _engine.DownloadSubtitleForTvShowEpisode(episode); } } if (!downloaded) { await Helper.ManualSubtitleDownload(_engine, _exceptionHandler, _dialogService, downloadable); if (downloadable.Media.IsModified) { await _engine.UpdateEntity(downloadable.Media); } } } else { var downloaded = await _engine.DownloadSubtitle(filePath); if (downloaded) { return; } var fileInfo = new FileInfo(filePath); if (fileInfo.Exists) { await Helper.ManualSubtitleDownload(_engine, _exceptionHandler, _dialogService, fileInfo); } } }