示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="applicationService">The application service</param>
        /// <param name="showService">The show service</param>
        /// <param name="userService">The user service</param>
        /// <param name="genreService">The genre service</param>
        public ShowPageViewModel(IApplicationService applicationService, IShowService showService,
                                 IUserService userService, IGenreService genreService)
        {
            _showService        = showService;
            _userService        = userService;
            _applicationService = applicationService;
            GenreViewModel      = new GenreViewModel(userService, genreService);
            RegisterCommands();
            RegisterMessages();

            Search = new SearchShowViewModel();

            DispatcherHelper.CheckBeginInvokeOnUI(async() =>
            {
                Tabs.Add(new PopularShowTabViewModel(_applicationService, showService, userService));
                Tabs.Add(new GreatestShowTabViewModel(_applicationService, showService, userService));
                Tabs.Add(new RecentShowTabViewModel(_applicationService, showService, userService));
                Tabs.Add(new FavoritesShowTabViewModel(_applicationService, showService, userService));
                SelectedTab = Tabs.First();
                SelectedShowsIndexMenuTab = 0;
                await GenreViewModel.LoadGenresAsync().ConfigureAwait(false);
                await Tabs.ToList().ParallelForEachAsync(async tab =>
                {
                    await tab.LoadShowsAsync().ConfigureAwait(false);
                }).ConfigureAwait(false);
            });
        }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="applicationService">The application service</param>
        /// <param name="showService">The show service</param>
        /// <param name="userService">The user service</param>
        /// <param name="genreService">The genre service</param>
        public ShowPageViewModel(IApplicationService applicationService, IShowService showService,
                                 IUserService userService, IGenreService genreService)
        {
            ShowService         = showService;
            UserService         = userService;
            _applicationService = applicationService;
            GenreViewModel      = new GenreViewModel(userService, genreService);
            RegisterCommands();
            RegisterMessages();

            Search = new SearchShowViewModel();
            Tabs.Add(new PopularShowTabViewModel(_applicationService, showService, userService));
            Tabs.Add(new GreatestShowTabViewModel(_applicationService, showService, userService));
            Tabs.Add(new RecentShowTabViewModel(_applicationService, showService, userService));
            Tabs.Add(new FavoritesShowTabViewModel(_applicationService, showService, userService));
            SelectedTab = Tabs.First();
            SelectedShowsIndexMenuTab = 0;
        }