public InitialSynchronization( ILogManager logManager, IGoogleMusicSynchronizationService synchronizationService, ISongsCachingService songsCachingService, IAlbumArtCacheService albumArtCacheService) { this.dbContext = new DbContext(); this.logger = logManager.CreateLogger("InitialSynchronization"); this.synchronizationService = synchronizationService; this.songsCachingService = songsCachingService; this.albumArtCacheService = albumArtCacheService; }
public LinksRegionViewPresenter( IApplicationStateService stateService, IApplicationResources resources, ISearchService searchService, IDispatcher dispatcher, IGoogleMusicSynchronizationService googleMusicSynchronizationService, IApplicationSettingViewsService applicationSettingViewsService, IGoogleMusicSessionService sessionService, INavigationService navigationService) { this.stateService = stateService; this.resources = resources; this.dispatcher = dispatcher; this.googleMusicSynchronizationService = googleMusicSynchronizationService; this.sessionService = sessionService; this.navigationService = navigationService; this.ShowSearchCommand = new DelegateCommand(searchService.Activate); this.NavigateToDownloadQueue = new DelegateCommand(async() => { if (!this.disableClickToCache) { await this.dispatcher.RunAsync(() => applicationSettingViewsService.Show("offlinecache")); } }); this.UpdateLibraryCommand = new DelegateCommand( async() => { if (this.UpdateLibraryCommand.CanExecute()) { this.synchronizationTimer.Stop(); await this.Synchronize(forceToDownloadPlaylists: true); } }, () => !this.BindingModel.ShowProgressRing); this.BindingModel = new LinksRegionBindingModel(); this.synchronizationTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(5) }; this.synchronizationTimer.Stop(); this.synchronizationTime = 0; this.synchronizationTimer.Tick += this.SynchronizationTimerOnTick; this.Logger.LogTask(this.Synchronize()); this.SetOfflineMessageIfRequired(); this.sessionService.SessionCleared += this.SessionServiceOnSessionCleared; }