Example #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);
        }
Example #2
0
        public DownloadManagerViewModel(IDownloadService downloadService, IDataContext dataContext)
        {
            m_DownloadService = downloadService ?? throw new ArgumentNullException(nameof(downloadService));
            m_DownloadService.SetDownloadProgress(ProgressHandler);
            m_DownloadService.SetDownloadFinished(FinishHandler);
            m_ReleaseCollection = dataContext.GetCollection <ReleaseEntity> ();
            CreateCommands();

            m_SelectedSection = m_Sections.First();
            ObserverEvents.SubscribeOnEvent("synchronizedReleases", RefreshAfterSynchronize);
        }
        public DownloadManagerViewModel(IDownloadService downloadService, IDataContext dataContext, IAnalyticsService analyticsService, IReleasesService releasesService)
        {
            m_DownloadService  = downloadService ?? throw new ArgumentNullException(nameof(downloadService));
            m_AnalyticsService = analyticsService ?? throw new ArgumentNullException(nameof(analyticsService));
            m_ReleasesService  = releasesService ?? throw new ArgumentNullException(nameof(releasesService));
            m_DownloadService.SetDownloadProgress(ProgressHandler);
            m_DownloadService.SetDownloadFinished(FinishHandler);
            CreateCommands();
            RestoreSettings();

            m_SelectedSection = m_Sections.First();
            m_PauseColor      = WhiteColor;
            m_PlayColor       = LightGrayColor;
            ObserverEvents.SubscribeOnEvent("synchronizedReleases", RefreshAfterSynchronize);
        }