Exemple #1
0
 public FileDiscoveryService(WallpaperManagerContext context)
 {
     Context       = context;
     ThemeRepo     = new WallpaperThemeRepository(context);
     DirectoryRepo = new WallpaperDirectoryRepository(context);
     FileCacheRepo = new FileDiscoveryCacheRepository(context);
 }
        public WallpaperManagerViewModelBase()
        {
            // Setup the Repos
            var context = new WallpaperManagerContext();

            ThemeRepository              = new WallpaperThemeRepository(context);
            DirectoryRepository          = new WallpaperDirectoryRepository(context);
            AccessTokenRepository        = new FileAccessTokenRepository(context);
            FileDiscoveryCacheRepository = new FileDiscoveryCacheRepository(context);

            // Setup the AppProducts
            try
            {
                InAppPurchaseManagerBase.AppProductsChanged += InAppPurchaseManager_AppProductsChanged;
                var product = InAppPurchaseManagerFactory.Create(true).GetAppProductByStoreID("9nzm4xdbvpk0");
                ProductAWMPro = product;
                Debug.WriteLine($"{nameof(WallpaperManagerViewModelBase)} | {ProductAWMPro}");
            }
            catch (Exception) { }
        }
        private void LoadFileCache(IProgress <IndicatorProgressReport> progress)
        {
            if (Theme == null)
            {
                return;
            }

            var cache = FileDiscoveryCacheRepository.GetAllQuery()
                        .Where(x => x.WallpaperThemeID == Theme.ID)
                        .OrderBy(x => x.FilePath)
                        .ToList();

            // If the cache exists, use it
            if (cache.Count > 0)
            {
                SetFileCache(cache);
            }
            else // Otherwise, lets try creating it
            {
                RefreshFileCache(progress);
            }
        }