public ImageCacheService(ApplicationSettingsService applicationSettingsService, ImageCacheRepository imageCacheRepository) { _imageCacheRepository = imageCacheRepository; if (_imageCacheRepository.CacheSize < MinCacheSize) { _imageCacheRepository.SetCacheSize(MinCacheSize, CacheTruncatePriority.RemoveLargest); applicationSettingsService.SaveSettings(); } applicationSettingsService.OnSettingsSaved += _applicationSettingsService_OnSettingsChanged; applicationSettingsService.OnSettingsLoaded += ApplicationSettingsService_OnSettingsLoaded; }
private void DoWork(object state) { try { ImageCacheRepository.LoadCache().Wait(); } catch (Exception e) { Logger.LogError(e, "Error loading cache"); } }