public ShellViewModel(
            SettingsViewModel settingsViewModel,
            MainViewModel mainViewModel,
            IEventAggregator eventAggregator,
            INavigationService navigationService)
        {
            if (settingsViewModel == null)
            {
                throw new ArgumentNullException(nameof(settingsViewModel));
            }
            if (mainViewModel == null)
            {
                throw new ArgumentNullException(nameof(mainViewModel));
            }
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }

            Settings               = settingsViewModel;
            this.mainViewModel     = mainViewModel;
            this.navigationService = navigationService;
            ActiveItem             = mainViewModel;

            eventAggregator.Subscribe(this);
            Settings.ActivateWith(this);

            currentAppVersion = GetType().Assembly.GetName().Version;
            DisplayName       = $"LIVESTREAM MONITOR V{currentAppVersion.Major}.{currentAppVersion.Minor}.{currentAppVersion.Build}";
#if DEBUG
            // helps to know that we're running the debug rather than release version of the exe
            DisplayName += " (DEBUG)";
#endif
        }
        public ShellViewModel(
            SettingsViewModel settingsViewModel,
            MainViewModel mainViewModel,
            IEventAggregator eventAggregator,
            INavigationService navigationService,
            IMonitorStreamsModel monitorStreamsModel,
            ISettingsHandler settingsHandler,
            PopularLivestreamWatcher popularLivestreamWatcher)
        {
            Settings                      = settingsViewModel ?? throw new ArgumentNullException(nameof(settingsViewModel));
            this.mainViewModel            = mainViewModel ?? throw new ArgumentNullException(nameof(mainViewModel));
            this.navigationService        = navigationService ?? throw new ArgumentNullException(nameof(navigationService));
            this.monitorStreamsModel      = monitorStreamsModel ?? throw new ArgumentNullException(nameof(monitorStreamsModel));
            this.settingsHandler          = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
            this.popularLivestreamWatcher = popularLivestreamWatcher ?? throw new ArgumentNullException(nameof(popularLivestreamWatcher));

            ActiveItem = mainViewModel;

            eventAggregator.Subscribe(this);
            Settings.ActivateWith(this);

            currentAppVersion = GetType().Assembly.GetName().Version;
            DisplayName       = $"LIVESTREAM MONITOR V{currentAppVersion.Major}.{currentAppVersion.Minor}.{currentAppVersion.Build}";
#if DEBUG
            // helps to know that we're running the debug rather than release version of the exe
            DisplayName += " (DEBUG)";
#endif
        }
        public LivestreamListViewModel(
            IMonitorStreamsModel monitorStreamsModel,
            FilterModel filterModel,
            StreamLauncher streamLauncher,
            INavigationService navigationService)
        {
            if (monitorStreamsModel == null)
            {
                throw new ArgumentNullException(nameof(monitorStreamsModel));
            }
            if (streamLauncher == null)
            {
                throw new ArgumentNullException(nameof(streamLauncher));
            }
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }

            this.streamLauncher    = streamLauncher;
            this.navigationService = navigationService;
            this.StreamsModel      = monitorStreamsModel;
            FilterModel            = filterModel;
            refreshTimer           = new DispatcherTimer {
                Interval = Constants.RefreshPollingTime
            };
        }
Example #4
0
        public TopStreamsViewModel(
            IMonitorStreamsModel monitorStreamsModel,
            ISettingsHandler settingsHandler,
            StreamLauncher streamLauncher,
            INavigationService navigationService,
            IApiClientFactory apiClientFactory)
        {
            if (monitorStreamsModel == null)
            {
                throw new ArgumentNullException(nameof(monitorStreamsModel));
            }
            if (settingsHandler == null)
            {
                throw new ArgumentNullException(nameof(settingsHandler));
            }
            if (streamLauncher == null)
            {
                throw new ArgumentNullException(nameof(streamLauncher));
            }
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (apiClientFactory == null)
            {
                throw new ArgumentNullException(nameof(apiClientFactory));
            }

            this.monitorStreamsModel = monitorStreamsModel;
            this.settingsHandler     = settingsHandler;
            this.streamLauncher      = streamLauncher;
            this.navigationService   = navigationService;
            this.apiClientFactory    = apiClientFactory;

            ItemsPerPage = STREAM_TILES_PER_PAGE;

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(Page))
                {
                    NotifyOfPropertyChange(() => CanPrevious);
                }
            };
        }