Example #1
0
        private async Task RequestTvShowSeason(TvShow tvShow)
        {
            var seasonSelection = await _userInterface.GetTvShowSeasonSelectionAsync(tvShow);

            if (!seasonSelection.IsCancelled && seasonSelection.SelectedSeason.IsSpecified)
            {
                var selectedSeason = seasonSelection.SelectedSeason.Value;

                switch (selectedSeason)
                {
                case FutureTvSeasons futureTvSeasons:
                    await new FutureSeasonsRequestingWorkflow(_user, _searcher, _requester, _userInterface, _notificationRequestRepository)
                    .HandleRequestAsync(tvShow, futureTvSeasons);
                    break;

                case AllTvSeasons allTvSeasons:
                    await new AllSeasonsRequestingWorkflow(_user, _searcher, _requester, _userInterface, _notificationRequestRepository)
                    .HandleRequestAsync(tvShow, allTvSeasons);
                    break;

                case NormalTvSeason normalTvSeason:
                    await new NormalTvSeasonRequestingWorkflow(_user, _searcher, _requester, _userInterface, _notificationRequestRepository)
                    .HandleRequestAsync(tvShow, normalTvSeason);
                    break;

                default:
                    throw new Exception($"Could not handle season of type \"{selectedSeason.GetType().Name}\"");
                }
            }
            else if (!seasonSelection.IsCancelled)
            {
                await _userInterface.WarnInvalidSeasonSelectionAsync();
            }
        }