public Settings() { Language = CultureInfo.CurrentUICulture.Name; ChangeOnTimer = true; RefreshInterval = 20; IntervalUnit = IntervalUnits.Minutes; ClearOldPics = false; ClearInterval = 3; PreFetch = false; MaxPictureDownloadCount = 100; MaxPreviousPictureDepth = 5; CheckForNewPulseVersions = true; CachePath = System.IO.Path.Combine(AppPath, "Cache"); ProviderSettings = new SerializableDictionary <Guid, ActiveProviderInfo>(); DownloadOnAppStartup = false; RunOnWindowsStartup = false; BannedImages = new List <string>(); //set wallpaper changer as a default provider for output ActiveProviderInfo apiWallpaper = new ActiveProviderInfo("Desktop Wallpaper"); apiWallpaper.Active = true; apiWallpaper.ExecutionOrder = 1; ProviderSettings.Add(apiWallpaper.ProviderInstanceID, apiWallpaper); //set wallbase as default for inputs ActiveProviderInfo apiWallbase = new ActiveProviderInfo("Wallbase"); ProviderSettings.Add(apiWallbase.ProviderInstanceID, apiWallbase); apiWallbase.Active = true; apiWallbase.ExecutionOrder = 1; }
protected void DownloadNextPicture() { if (CurrentInputProviders.Count == 0) { return; } //create the new picture batch PictureBatch pb = new PictureBatch() { PreviousBatch = CurrentBatch }; //create another view of the input providers, otherwise if the list changes // because user changes options then it breaks :) foreach (KeyValuePair <Guid, ActiveProviderInfo> kvpGAPI in CurrentInputProviders.ToArray()) { ActiveProviderInfo api = kvpGAPI.Value; var ps = new PictureSearch() { SaveFolder = Settings.CurrentSettings.CachePath, MaxPictureCount = Settings.CurrentSettings.MaxPictureDownloadCount, SearchProvider = api, BannedURLs = Settings.CurrentSettings.BannedImages }; //get new pictures PictureList pl = PictureManager.GetPictureList(ps); //save to picturebatch pb.AllPictures.Add(pl); } //process downloaded picture list ProcessDownloadedPicture(pb); //if prefetch is enabled, validate that all pictures have been downloaded if (Settings.CurrentSettings.PreFetch) { DownloadManager.PreFetchFiles(pb); } }