Beispiel #1
0
        public HomeViewModel(IAnilibriaApiService anilibriaApiService)
        {
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));

            var version = Package.Current.Id.Version;

            Version = $"{version.Major}.{version.Minor}.{version.Build}";

            m_MenuItems = new List <SplitViewItem> {
                new SplitViewItem {
                    Name          = "Каталог релизов",
                    Page          = ReleasesPage,
                    IconUri       = new Uri("ms-appx:///Assets/Icons/hambergermenu.svg"),
                    IsVisible     = StubMenuIsVisible,
                    IsReleasePage = true
                },
                new SplitViewItem {
                    Name           = "Видеоплеер",
                    Page           = PlayerPage,
                    IconUri        = new Uri("ms-appx:///Assets/Icons/videoplayer.svg"),
                    IsVisible      = StubMenuIsVisible,
                    IsOnlinePlayer = true
                },
                new SplitViewItem {
                    Name          = "Youtube",
                    Page          = YoutubePage,
                    IconUri       = new Uri("ms-appx:///Assets/Icons/youtube.svg"),
                    IsVisible     = StubMenuIsVisible,
                    IsYoutubePage = true
                },
                new SplitViewItem {
                    Name         = "Поддержать проект",
                    Page         = DonatePage,
                    IconUri      = new Uri("ms-appx:///Assets/Icons/donate.svg"),
                    IsVisible    = StubMenuIsVisible,
                    IsDonatePage = true
                },
                new SplitViewItem {
                    Name         = "Войти",
                    Page         = AuthorizePage,
                    IconUri      = new Uri("ms-appx:///Assets/Icons/user.svg"),
                    IsVisible    = AuthorizeOptionIsVisible,
                    IsSigninPage = true
                }

                /*,
                 * new SplitViewItem {
                 *      Name = "Менеджер загрузок",
                 *      Page = "Torrents",
                 *      Icon = "\xE896"
                 * }*/
            };
            RefreshOptions();

            CreateCommands();

            ObserverEvents.SubscribeOnEvent("showMessage", ShowMessage);

            LaunchParameters.AddSubscriber(ChangeLaunchParameter);
        }
Beispiel #2
0
        /// <summary>
        /// Constructor injection.
        /// </summary>
        /// <param name="analyticsService">Analytics service.</param>
        /// <param name="dataContext">Data context.</param>
        /// <param name="anilibriaApiService">Anilibria restful service.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public OnlinePlayerViewModel(IAnalyticsService analyticsService, IDataContext dataContext, IAnilibriaApiService anilibriaApiService)
        {
            m_AnalyticsService    = analyticsService ?? throw new ArgumentNullException(nameof(analyticsService));
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));
            m_DataContext         = dataContext ?? throw new ArgumentNullException(nameof(dataContext));
            m_IsSD   = true;
            m_Volume = .8;

            RestoreSettings();

            UpdateVolumeState(m_Volume);

            CreateCommands();

            m_RestoreCollection   = m_DataContext.GetCollection <PlayerRestoreEntity> ();
            m_PlayerRestoreEntity = m_RestoreCollection.FirstOrDefault();
            if (m_PlayerRestoreEntity == null)
            {
                m_PlayerRestoreEntity = new PlayerRestoreEntity {
                    ReleaseId     = -1,
                    VideoId       = -1,
                    VideoPosition = 0
                };
                m_RestoreCollection.Add(m_PlayerRestoreEntity);
            }

            m_ReleaseStateCollection    = m_DataContext.GetCollection <ReleaseVideoStateEntity> ();
            m_IsSupportedCompactOverlay = ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay);
        }
Beispiel #3
0
        /// <summary>
        /// Constructor injection.
        /// </summary>
        /// <param name="anilibriaApiService">Anilibria api service.</param>
        public YoutubeViewModel(IAnilibriaApiService anilibriaApiService)
        {
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));

            CreateCommands();
            RefreshVideos();
            RefreshSelectedVideos();
        }
        /// <summary>
        /// Constructor injection.
        /// </summary>
        /// <param name="anilibriaApiService">Anilibria api service.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public AuthorizeViewModel(IAnilibriaApiService anilibriaApiService, IAnalyticsService analyticsService)
        {
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));
            m_AnalyticsService    = analyticsService ?? throw new ArgumentNullException(nameof(analyticsService));

            CreateCommands();

            m_AnalyticsService.TrackEvent("AuthorizePage", "Opened", "Simple start");
        }
        public CinemaHallViewModel(IAnilibriaApiService anilibriaApiService, IDataContext dataContext, IAnalyticsService analyticsService)
        {
            m_DataContext         = dataContext ?? throw new ArgumentNullException(nameof(dataContext));
            m_AnalyticsService    = analyticsService ?? throw new ArgumentNullException(nameof(analyticsService));
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));

            RefreshSelectedReleases();

            CreateCommand();
        }
 /// <summary>
 /// Constructor injection.
 /// </summary>
 /// <param name="anilibriaApiService">Anilibria api service.</param>
 /// <param name="dataContext">Data context.</param>
 /// <exception cref="ArgumentNullException"></exception>
 public SynchronizeService(IAnilibriaApiService anilibriaApiService, IDataContext dataContext)
 {
     m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));
     m_DataContext         = dataContext ?? throw new ArgumentNullException(nameof(dataContext));
 }