public ToWatchViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IHamburgerMenuService hamburgerMenuService,
            IEventService eventService,
            IToastNotificationService toastNotificationService)
        {
            _tvshowtimeApiService     = tvshowtimeApiService;
            _hamburgerMenuService     = hamburgerMenuService;
            _eventService             = eventService;
            _toastNotificationService = toastNotificationService;

            SelectEpisodeCommand = new RelayCommand <Episode>(SelectEpisode);

            Refresh();

            _eventService.WatchEpisodeEvent
            .Concat(_eventService.UnwatchEpisodeEvent)
            .Subscribe((episode) =>
            {
                _watchedOrUnwatchedEpisode = true;
            });

            _eventService.FollowShowEvent
            .Concat(_eventService.UnfollowShowEvent)
            .Subscribe((show) =>
            {
                _followedOrUnfollowedShow = true;
            });
        }
 public override void SetRepositories()
 {
     _MasterRepo.NetworkInterface = (U, P, A) => ExecuteQueryWithObjectAndNetworkAccessAsync(U, P, A);
     _MasterRepo.NetworkInterfaceWithTypedParameters = (U, P, A) => ExecuteQueryWithTypedParametersAndNetworkAccessAsync(U, P, A);
     _Service    = new HamburgerMenuService(_MasterRepo.NetworkInterface);
     _Reposetory = new HamburgerMenuRepository(_MasterRepo, _Service);
 }
示例#3
0
        public MainPage()
        {
            this.InitializeComponent();

            // Retrieve colors from app resources
            var primaryBlackColor  = (App.Current.Resources["PrimaryBlack"] as SolidColorBrush).Color;
            var primaryWhiteColor  = (App.Current.Resources["PrimaryWhite"] as SolidColorBrush).Color;
            var primaryYellowColor = (App.Current.Resources["PrimaryYellow"] as SolidColorBrush).Color;

            // Style title bar (Desktop)
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.ButtonBackgroundColor = primaryBlackColor;
                    titleBar.ButtonForegroundColor = primaryWhiteColor;

                    titleBar.ButtonHoverBackgroundColor = primaryYellowColor;
                    titleBar.ButtonHoverForegroundColor = primaryBlackColor;

                    titleBar.ButtonPressedBackgroundColor = Color.FromArgb(
                        primaryYellowColor.A,
                        primaryYellowColor.R,
                        primaryYellowColor.G,
                        (byte)(primaryYellowColor.B + 100));
                    titleBar.ButtonPressedForegroundColor = primaryBlackColor;

                    titleBar.BackgroundColor = primaryBlackColor;
                    titleBar.ForegroundColor = primaryWhiteColor;
                }
            }

            // Style status bar (Mobile)
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundOpacity = 1;
                    statusBar.BackgroundColor   = primaryBlackColor;
                    statusBar.ForegroundColor   = primaryWhiteColor;
                }
            }

            // Register a handler for BackRequested events
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            // Manage hamburger menu service
            _hamburgerMenuService = ServiceLocator.Current.GetInstance <IHamburgerMenuService>();

            HamburgerMenuControl.ItemsSource        = _hamburgerMenuService.MenuItems.Where(item => item.Type == MenuItemType.Main);
            HamburgerMenuControl.OptionsItemsSource = _hamburgerMenuService.MenuItems.Where(item => item.Type == MenuItemType.Options);

            // After the page is loaded
            Loaded += OnLoaded;
        }
示例#4
0
        public UpcomingViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IHamburgerMenuService hamburgerMenuService)
        {
            _tvshowtimeApiService = tvshowtimeApiService;
            _hamburgerMenuService = hamburgerMenuService;

            SelectEpisodeCommand = new RelayCommand <UpcomingEpisodeViewModel>(SelectEpisode);

            Initialize();
        }
示例#5
0
        public MainViewModel(
            INavigationService navigationService,
            IHamburgerMenuService hamburgerMenuService)
        {
            _navigationService    = navigationService;
            _hamburgerMenuService = hamburgerMenuService;

            _localObjectStorageHelper = ServiceLocator.Current.GetInstance <IObjectStorageHelper>(ServiceLocatorConstants.LocalObjectStorageHelper);

            RegisterBackgroundTasks();
        }
        public AgendaViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IHamburgerMenuService hamburgerMenuService,
            IEventService eventService)
        {
            _tvshowtimeApiService = tvshowtimeApiService;
            _hamburgerMenuService = hamburgerMenuService;
            _eventService         = eventService;

            SelectEpisodeCommand = new RelayCommand <Episode>(SelectEpisode);

            LoadAgendaPage(_currentPage);
        }
示例#7
0
        public ShowViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IEventService eventService,
            IToastNotificationService toastNotificationService,
            IHamburgerMenuService hamburgerMenuService)
        {
            _tvshowtimeApiService     = tvshowtimeApiService;
            _eventService             = eventService;
            _toastNotificationService = toastNotificationService;
            _hamburgerMenuService     = hamburgerMenuService;

            GoToPreviousSeasonCommand = new RelayCommand(GoToPreviousSeason);
            GoToNextSeasonCommand     = new RelayCommand(GoToNextSeason);
            SelectEpisodeCommand      = new RelayCommand <Episode>(SelectEpisode);
        }
示例#8
0
        public ExploreViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IEventService eventService,
            IHamburgerMenuService hamburgerMenuService)
        {
            _tvshowtimeApiService = tvshowtimeApiService;
            _eventService         = eventService;
            _hamburgerMenuService = hamburgerMenuService;

            SelectionChangedCommand = new RelayCommand <int>(SelectionChanged);
            ToggleFollowShowCommand = new RelayCommand <ExploreShowViewModel>(ToggleFollowShow);
            SelectShowCommand       = new RelayCommand <long>(SelectShow);

            LoadTrendingShows(_currentPage);
        }
        public EpisodeViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IEventService eventService,
            IHamburgerMenuService hamburgerMenuService)
        {
            _tvshowtimeApiService = tvshowtimeApiService;
            _eventService         = eventService;
            _hamburgerMenuService = hamburgerMenuService;

            ToggleWatchCommand         = new RelayCommand(ToggleWatch);
            GoToPreviousEpisodeCommand = new RelayCommand(GoToPreviousEpisode);
            GoToNextEpisodeCommand     = new RelayCommand(GoToNextEpisode);
            ToggleEmotionCommand       = new RelayCommand <Emotion>(ToggleEmotion);
            SelectShowCommand          = new RelayCommand <Episode>(SelectShow);
        }
示例#10
0
        public AgendaViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IHamburgerMenuService hamburgerMenuService,
            IEventService eventService,
            IToastNotificationService toastNotificationService)
        {
            _tvshowtimeApiService     = tvshowtimeApiService;
            _hamburgerMenuService     = hamburgerMenuService;
            _eventService             = eventService;
            _toastNotificationService = toastNotificationService;

            SelectEpisodeCommand = new RelayCommand <Episode>(SelectEpisode);

            Refresh();
        }
        public CollectionViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IEventService eventService,
            IHamburgerMenuService hamburgerMenuService,
            IToastNotificationService toastNotificationService)
        {
            _tvshowtimeApiService     = tvshowtimeApiService;
            _eventService             = eventService;
            _hamburgerMenuService     = hamburgerMenuService;
            _toastNotificationService = toastNotificationService;

            SelectShowCommand = new RelayCommand <Show>(SelectShow);

            _allGroup = new ShowCollectionGroup {
                Name = "All"
            };
            _lateGroup = new ShowCollectionGroup {
                Name = "Late"
            };
            _upToDateGroup = new ShowCollectionGroup {
                Name = "Up to date"
            };
            _continuingGroup = new ShowCollectionGroup {
                Name = "Continuing"
            };
            _endedGroup = new ShowCollectionGroup {
                Name = "Ended"
            };
            _archivedGroup = new ShowCollectionGroup {
                Name = "Archived"
            };

            Groups.Add(_allGroup);
            Groups.Add(_lateGroup);
            Groups.Add(_upToDateGroup);
            Groups.Add(_continuingGroup);
            Groups.Add(_endedGroup);
            Groups.Add(_archivedGroup);

            Refresh();
        }
        public ToWatchViewModel(
            IReactiveTVShowTimeApiService tvshowtimeApiService,
            IHamburgerMenuService hamburgerMenuService,
            IEventService eventService)
        {
            _tvshowtimeApiService = tvshowtimeApiService;
            _hamburgerMenuService = hamburgerMenuService;
            _eventService         = eventService;

            SelectEpisodeCommand = new RelayCommand <Episode>(SelectEpisode);

            Refresh();

            _eventService.WatchEpisodeEvent
            .Subscribe((episode) =>
            {
                Refresh();
            });

            _eventService.UnwatchEpisodeEvent
            .Subscribe((episode) =>
            {
                Refresh();
            });

            _eventService.FollowShowEvent
            .Subscribe((show) =>
            {
                Refresh();
            });

            _eventService.UnfollowShowEvent
            .Subscribe((show) =>
            {
                var episodeOfTheShow = Episodes.FirstOrDefault(e => e.Show.Id == show.Id);
                if (episodeOfTheShow != null)
                {
                    Episodes.Remove(episodeOfTheShow);
                }
            });
        }
示例#13
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == NavigationMode.New)
            {
                // Initialize hamburger menu service
                _hamburgerMenuService = ServiceLocator.Current.GetInstance <IHamburgerMenuService>();
                InitializeHamburgerNavigationService();
                _hamburgerMenuService.NavigateTo(ViewConstants.ToWatch);
            }

            // Style title bar (Desktop)
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                Window.Current.SetTitleBar(ExtendedTitleBar);
            }

            // Each time a navigation event occurs, update the Back button's visibility
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
        }
示例#14
0
 public HamburgerMenuRepository(IMasterRepository masterRepository, IHamburgerMenuService service)
     : base(masterRepository)
 {
     _Service = service;
 }