public void Post(OrganizeEpisode request) { var dicNewProviderIds = new Dictionary <string, string>(); if (request.NewSeriesProviderIds != null) { dicNewProviderIds = request.NewSeriesProviderIds; } var task = _iFileOrganizationService.PerformEpisodeOrganization(new EpisodeFileOrganizationRequest { EndingEpisodeNumber = request.EndingEpisodeNumber, EpisodeNumber = request.EpisodeNumber, RememberCorrection = request.RememberCorrection, ResultId = request.Id, SeasonNumber = request.SeasonNumber, SeriesId = request.SeriesId, NewSeriesName = request.NewSeriesName, NewSeriesYear = request.NewSeriesYear, NewSeriesProviderIds = dicNewProviderIds, TargetFolder = request.TargetFolder }); // For async processing (close dialog early instead of waiting until the file has been copied) //var tasks = new Task[] { task }; //Task.WaitAll(tasks, 8000); Task.WaitAll(task); }
public void Post(OrganizeEpisode request) { var dicNewProviderIds = new Dictionary <string, string>(); if (request.NewSeriesProviderIds != null) { dicNewProviderIds = request.NewSeriesProviderIds; } // Don't await this var task = _iFileOrganizationService.PerformEpisodeOrganization(new EpisodeFileOrganizationRequest { EndingEpisodeNumber = request.EndingEpisodeNumber, EpisodeNumber = request.EpisodeNumber, RememberCorrection = request.RememberCorrection, ResultId = request.Id, SeasonNumber = request.SeasonNumber, SeriesId = request.SeriesId, NewSeriesName = request.NewSeriesName, NewSeriesYear = request.NewSeriesYear, NewSeriesProviderIds = dicNewProviderIds, TargetFolder = request.TargetFolder }); // Async processing (close dialog early instead of waiting until the file has been copied) // Wait 2s for exceptions that may occur to have them forwarded to the client for immediate error display task.Wait(2000); }
public void Post(OrganizeEpisode request) { var task = _iFileOrganizationService.PerformEpisodeOrganization(new EpisodeFileOrganizationRequest { EndingEpisodeNumber = request.EndingEpisodeNumber, EpisodeNumber = request.EpisodeNumber, RememberCorrection = request.RememberCorrection, ResultId = request.Id, SeasonNumber = request.SeasonNumber, SeriesId = request.SeriesId }); Task.WaitAll(task); }