예제 #1
0
        public MainWindowVM(IKernel kernel,
                            IEventAggregator eventAggregator,
                            ITwitchService twitchService,
                            IDialogService dialogService,
                            INavigationService navigationService,
                            ISearchService searchService,
                            IPreferencesService preferencesService,
                            IRuntimeDataService runtimeDataService,
                            IUpdateService updateService)
        {
            AssemblyUtil au = AssemblyUtil.Get;

            this.title = au.GetProductName() + " " + au.GetAssemblyVersion().Trim();

            this.kernel             = kernel;
            this.eventAggregator    = eventAggregator;
            this.twitchService      = twitchService;
            this.dialogService      = dialogService;
            this.navigationService  = navigationService;
            this.searchService      = searchService;
            this.preferencesService = preferencesService;
            this.runtimeDataService = runtimeDataService;
            this.updateService      = updateService;

            this.commandLockObject = new object();

            this.eventAggregator.GetEvent <ShowViewEvent>().Subscribe(this.ShowView);
            this.eventAggregator.GetEvent <IsAuthorizedChangedEvent>().Subscribe(this.IsAuthorizedChanged);
            this.eventAggregator.GetEvent <VideosCountChangedEvent>().Subscribe(this.VideosCountChanged);
            this.eventAggregator.GetEvent <DownloadsCountChangedEvent>().Subscribe(this.DownloadsCountChanged);
        }
        public MainWindowVM(IKernel kernel,
                            IEventAggregator eventAggregator,
                            ITwitchService twitchService,
                            IGuiService guiService,
                            IPreferencesService preferencesService,
                            IUpdateService updateService)
        {
            this.mainViews = new Dictionary <Type, ViewModelBase>();

            this.windowState = WindowState.Normal;

            AssemblyUtil au = AssemblyUtil.Get;

            this.title = au.GetProductName() + " " + au.GetAssemblyVersion().Trim();

            this.kernel             = kernel;
            this.eventAggregator    = eventAggregator;
            this.twitchService      = twitchService;
            this.guiService         = guiService;
            this.preferencesService = preferencesService;
            this.updateService      = updateService;

            this.ShowMainView <WelcomeViewVM>();

            this.eventAggregator.GetEvent <SearchBeginEvent>().Subscribe(() => this.ShowMainView <VideosLoadingViewVM>());
            this.eventAggregator.GetEvent <SearchCompleteEvent>().Subscribe(() => this.ShowMainView <VideosViewVM>());
            this.eventAggregator.GetEvent <ShowVideosEvent>().Subscribe(() => this.ShowMainView <VideosViewVM>());
            this.eventAggregator.GetEvent <ShowDownloadsEvent>().Subscribe(() => this.ShowMainView <DownloadsViewVM>());
            this.eventAggregator.GetEvent <ShowPreferencesEvent>().Subscribe(() => this.ShowMainView <PreferencesViewVM>());
            this.eventAggregator.GetEvent <ShowInfoEvent>().Subscribe(() => this.ShowMainView <InfoViewVM>());
            this.eventAggregator.GetEvent <PreferencesSavedEvent>().Subscribe(() => this.PreferencesSaved());
        }
예제 #3
0
        public MainWindowVM(IKernel kernel,
                            IEventAggregator eventAggregator,
                            ITwitchService twitchService,
                            IDialogService dialogService,
                            INavigationService navigationService,
                            ISearchService searchService,
                            IPreferencesService preferencesService,
                            IRuntimeDataService runtimeDataService,
                            IUpdateService updateService)
        {
            AssemblyUtil au = AssemblyUtil.Get;

            _title = au.GetProductName() + " " + au.GetAssemblyVersion().Trim();

            _kernel             = kernel;
            _eventAggregator    = eventAggregator;
            _twitchService      = twitchService;
            _dialogService      = dialogService;
            _navigationService  = navigationService;
            _searchService      = searchService;
            _preferencesService = preferencesService;
            _runtimeDataService = runtimeDataService;
            _updateService      = updateService;

            _commandLockObject = new object();

            _eventAggregator.GetEvent <ShowViewEvent>().Subscribe(ShowView);
            _eventAggregator.GetEvent <IsAuthorizedChangedEvent>().Subscribe(IsAuthorizedChanged);
            _eventAggregator.GetEvent <PreferencesSavedEvent>().Subscribe(PreferencesSaved);
            _eventAggregator.GetEvent <VideosCountChangedEvent>().Subscribe(VideosCountChanged);
            _eventAggregator.GetEvent <DownloadsCountChangedEvent>().Subscribe(DownloadsCountChanged);

            _showDonationButton = _preferencesService.CurrentPreferences.AppShowDonationButton;
        }
예제 #4
0
        public DownloadsViewVM(ITwitchService twitchService, IGuiService guiService, IEventAggregator eventAggregator)
        {
            if (twitchService == null)
            {
                throw new ArgumentNullException(nameof(twitchService));
            }

            if (guiService == null)
            {
                throw new ArgumentNullException(nameof(guiService));
            }

            if (eventAggregator == null)
            {
                throw new ArgumentNullException(nameof(eventAggregator));
            }

            this.twitchService   = twitchService;
            this.guiService      = guiService;
            this.eventAggregator = eventAggregator;

            this.twitchService.PropertyChanged += TwitchService_PropertyChanged;

            this.commandLockObject = new object();
        }
예제 #5
0
        public MainPageViewModel()
        {
            _twitchService         = App.Current?.Container?.Resolve <ITwitchService>();
            _suaveKeysService      = App.Current?.Container?.Resolve <ISuaveKeysService>();
            CommandLog             = "";
            SuaveKeysSignInCommand = new Command(async() =>
            {
                var signInResult    = await _suaveKeysService.StartSignInAsync();
                IsLinkedToSuaveKeys = signInResult?.ResultType == ResultType.Ok;
            });
            TwitchSignInCommand = new Command(async() =>
            {
                var signInResult = await _twitchService.StartSignInAsync();
                IsLinkedToTwitch = signInResult?.ResultType == ResultType.Ok;
            });
            ToggleStartCommand = new Command(async() =>
            {
                var startResult = await _twitchService.ToggleListeningAsync(Channel);
                if (startResult?.ResultType == ResultType.Ok)
                {
                    IsListening = !IsListening;
                }
            });

            _twitchService.OnCommandReceived += TwitchService_OnCommandReceived;
        }
예제 #6
0
 public ChannelsController(IChannelAggregateService channelService,
                           ICrudRepository crudRepository, ITwitchService twitchService)
 {
     _channelService = channelService;
     _crudRepository = crudRepository;
     _twitchService  = twitchService;
 }
예제 #7
0
 public BotService(ITwitchService twitchService, IConfiguration configuration, ILogger<IBotService> logger, IStorageService storageService)
 {
     _twitchService = twitchService;
     _configuration = configuration;
     _logger = logger;
     _storageService = storageService;
 }
예제 #8
0
        public WelcomeViewVM(
            IPreferencesService preferencesService,
            IPersistenceService persistenceService,
            IDialogService dialogService,
            ITwitchService twitchService)
        {
            _preferencesService = preferencesService;
            _persistenceService = persistenceService;
            _dialogService      = dialogService;
            _twitchService      = twitchService;

            AssemblyUtil au = AssemblyUtil.Get;

            ProductName = au.GetProductName() + " " + au.GetAssemblyVersion().Trim();

            if (_preferencesService.CurrentPreferences.DownloadRememberQueue)
            {
                _persistenceService.GetDownloads();
                if (_persistenceService.Downloads.Count > 0)
                {
                    if (_dialogService.ShowMessageBox("You had downloads from your previous session would you like to resume them?", "Restore previous session?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        foreach (var itm in _persistenceService.Downloads)
                        {
                            _twitchService.Enqueue(itm.DownloadParams, id: itm.Id);
                        }
                    }
                    else
                    {
                        _persistenceService.PurgeDownloads();
                    }
                }
            }
        }
 public static void ConfigureProviders()
 {
     twitchService  = ServiceProvider.GetService <ITwitchService>();
     commandService = ServiceProvider.GetService <ICommandService>();
     channelService = ServiceProvider.GetService <IChannelService>();
     messageHandler = ServiceProvider.GetService <IMessageHandler>();
 }
예제 #10
0
 public Worker(
     ILogger <Worker> logger,
     ITwitchService twitchService,
     IMessageHandler msgHandler)
 {
     _logger        = logger;
     _twitchService = twitchService;
     _msgHandler    = msgHandler;
 }
예제 #11
0
        public DownloadsViewVM(ITwitchService twitchService, IGuiService guiService)
        {
            this.twitchService = twitchService;
            this.guiService    = guiService;

            this.twitchService.PropertyChanged += TwitchService_PropertyChanged;

            this.commandLockObject = new object();
        }
예제 #12
0
        public AuthenticateForm(AuthenticationController authenticationController, ITwitchService twitchService)
        {
            _authenticationController = authenticationController;
            _twitchService            = twitchService;

            InitializeComponent();

            BindWebBrowserHandlers();
        }
예제 #13
0
        public VideosViewVM(ITwitchService twitchService, IGuiService guiService, IEventAggregator eventAggregator)
        {
            this.twitchService   = twitchService;
            this.guiService      = guiService;
            this.eventAggregator = eventAggregator;

            this.twitchService.PropertyChanged += TwitchService_PropertyChanged;

            this.commandLockObject = new object();
        }
예제 #14
0
        public SearchViewVM(
            ITwitchService twitchService,
            ISearchService searchService,
            IDialogService dialogService,
            INavigationService navigationService)
        {
            _twitchService     = twitchService;
            _searchService     = searchService;
            _dialogService     = dialogService;
            _navigationService = navigationService;

            _commandLockObject = new object();
        }
예제 #15
0
        public DownloadViewVM(
            IDialogService dialogService,
            ITwitchService twitchService,
            INavigationService navigationService,
            INotificationService notificationService)
        {
            _dialogService       = dialogService;
            _twitchService       = twitchService;
            _navigationService   = navigationService;
            _notificationService = notificationService;

            _commandLockObject = new object();
        }
예제 #16
0
        public DownloadsViewVM(
            ITwitchService twitchService,
            IDialogService dialogService,
            INavigationService navigationService)
        {
            _twitchService     = twitchService;
            _dialogService     = dialogService;
            _navigationService = navigationService;

            _twitchService.PropertyChanged += TwitchService_PropertyChanged;

            _commandLockObject = new object();
        }
예제 #17
0
        public SearchViewVM(
            ITwitchService twitchService,
            ISearchService searchService,
            IDialogService dialogService,
            INavigationService navigationService)
        {
            this.twitchService     = twitchService;
            this.searchService     = searchService;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;

            this.commandLockObject = new object();
        }
        public TwitchConnectViewVM(
            IDialogService dialogService,
            ITwitchService twitchService,
            INavigationService navigationService,
            INotificationService notificationService)
        {
            this.dialogService       = dialogService;
            this.twitchService       = twitchService;
            this.navigationService   = navigationService;
            this.notificationService = notificationService;

            this.commandLockObject = new object();
        }
예제 #19
0
        public MessageHandler(
            ICommandService commandService,
            ITwitchService service,
            IConfiguration configuration)
        {
            this.commandService = commandService;
            this.TwitchService  = service;

            Username = configuration.GetSection("Credentials").GetSection("Username").Value;

            Handler += PongMessageReceivedHandler;
            Handler += AtBotMessageReceivedHandler;
            Handler += CommandMessageReceivedHandler;
        }
예제 #20
0
        public SearchViewVM(
            ITwitchService twitchService,
            ISearchService searchService,
            IDialogService dialogService,
            INavigationService navigationService,
            IPreferencesService preferencesService)
        {
            this._twitchService      = twitchService;
            this._searchService      = searchService;
            this._dialogService      = dialogService;
            this._navigationService  = navigationService;
            this._preferencesService = preferencesService;

            this._commandLockObject = new object();
        }
예제 #21
0
        public SearchService(
            IEventAggregator eventAggregator,
            IDialogService dialogService,
            ITwitchService twitchService,
            INavigationService navigationService,
            IPreferencesService preferencesService)
        {
            this.eventAggregator    = eventAggregator;
            this.dialogService      = dialogService;
            this.twitchService      = twitchService;
            this.navigationService  = navigationService;
            this.preferencesService = preferencesService;

            this.eventAggregator.GetEvent <PreferencesSavedEvent>().Subscribe(this.PreferencesSaved);
        }
예제 #22
0
        public SearchService(
            IEventAggregator eventAggregator,
            IDialogService dialogService,
            ITwitchService twitchService,
            INavigationService navigationService,
            IPreferencesService preferencesService)
        {
            _eventAggregator    = eventAggregator;
            _dialogService      = dialogService;
            _twitchService      = twitchService;
            _navigationService  = navigationService;
            _preferencesService = preferencesService;

            _eventAggregator.GetEvent <PreferencesSavedEvent>().Subscribe(PreferencesSaved);
        }
예제 #23
0
        public DownloadsViewVM(
            ITwitchService twitchService,
            IDialogService dialogService,
            INavigationService navigationService,
            IEventAggregator eventAggregator)
        {
            this.twitchService     = twitchService;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;
            this.eventAggregator   = eventAggregator;

            this.twitchService.PropertyChanged += TwitchService_PropertyChanged;

            this.commandLockObject = new object();
        }
        public void GetBannedList_WithValidChannelList_ShouldReturnDistinctBannedUserList()
        {
            // ARRANGE
            _storageServiceMock
            .Setup(x => x.GetTwitchChannels())
            .Returns(Task.FromResult(new List <string> {
                "testChannel"
            }));
            _sut = new TwitchService(_twitchOptionsMonitorMock.Object, _tableStorageoptionsMonitorMock.Object, _httpContextAccessorMock.Object, _fakeTwitchHttpClient, _storageServiceMock.Object, _loggerMock.Object);

            // ACT
            var result = _sut.GetBannedList(null);

            // ASSERT
            Assert.NotEmpty(result.Result);
        }
예제 #25
0
        public VideosViewVM(ITwitchService twitchService,
                            IGuiService guiService,
                            IEventAggregator eventAggregator,
                            IPreferencesService preferencesService,
                            IFilenameService filenameService)
        {
            this.twitchService      = twitchService;
            this.guiService         = guiService;
            this.eventAggregator    = eventAggregator;
            this.preferencesService = preferencesService;
            this.filenameService    = filenameService;

            this.twitchService.PropertyChanged += TwitchService_PropertyChanged;

            this.commandLockObject = new object();
        }
예제 #26
0
        public DownloadsViewVM(
            ITwitchService twitchService,
            IDialogService dialogService,
            INavigationService navigationService,
            IEventAggregator eventAggregator,
            IPreferencesService preferencesService)
        {
            _twitchService      = twitchService;
            _dialogService      = dialogService;
            _navigationService  = navigationService;
            _eventAggregator    = eventAggregator;
            _preferencesService = preferencesService;

            _twitchService.PropertyChanged += TwitchService_PropertyChanged;

            _commandLockObject = new object();
        }
예제 #27
0
        public RevokeAuthorizationViewVM(
            IDialogService dialogService,
            ITwitchService twitchService,
            INavigationService navigationService,
            INotificationService notificationService,
            IEventAggregator eventAggregator)
        {
            this.dialogService       = dialogService;
            this.twitchService       = twitchService;
            this.navigationService   = navigationService;
            this.notificationService = notificationService;
            this.eventAggregator     = eventAggregator;

            this.commandLockObject = new object();

            this.eventAggregator.GetEvent <IsAuthorizedChangedEvent>().Subscribe(this.IsAuthorizedChanged);
        }
예제 #28
0
        public SearchResultViewVM(
            ITwitchService twitchService,
            IDialogService dialogService,
            INavigationService navigationService,
            IPreferencesService preferencesService,
            IFilenameService filenameService)
        {
            _twitchService      = twitchService;
            _dialogService      = dialogService;
            _navigationService  = navigationService;
            _preferencesService = preferencesService;
            _filenameService    = filenameService;

            _twitchService.PropertyChanged += TwitchService_PropertyChanged;

            _commandLockObject = new object();
        }
예제 #29
0
        public DownloadViewVM(
            IDialogService dialogService,
            IFilenameService filenameService,
            IPreferencesService preferencesService,
            ITwitchService twitchService,
            INavigationService navigationService,
            INotificationService notificationService)
        {
            _dialogService       = dialogService;
            _filenameService     = filenameService;
            _preferencesService  = preferencesService;
            _twitchService       = twitchService;
            _navigationService   = navigationService;
            _notificationService = notificationService;

            _commandLockObject = new object();
        }
예제 #30
0
        public FailedDownloadsViewVM(
            ITwitchService twitchService,
            IDialogService dialogService,
            INavigationService navigationService,
            IPreferencesService preferencesService,
            IPersistenceService persistenceService,
            IExportService exportService)
        {
            _twitchService      = twitchService;
            _dialogService      = dialogService;
            _navigationService  = navigationService;
            _preferencesService = preferencesService;
            _persistenceService = persistenceService;
            _exportService      = exportService;

            _persistenceService.PropertyChanged += PersistenceService_PropertyChanged;

            _commandLockObject = new object();

            _persistenceService.GetFailedDownloads();
        }