public TimerViewModel(ISettingsProvider sp, Downloader downloader) { SettingsProvider = sp; ImageDownloader = downloader; Interval = sp.Interval; }
public MainViewModel() { CurrentSearchOptions = new SearchOptionsViewModel(Settings, new SearchOptions()); NotifyPropertyChanged("CurrentSearchOptions"); if (OverrideSettings) { CurrentSearchOptions.Search = "landscape"; CurrentSearchOptions.Category = Category.General; CurrentSearchOptions.Purity = PurityLevel.Safe; CurrentSearchOptions.Resolution = new ResolutionViewModel(new Resolution(1920, 1200, ResolutionType.AtLeast)); CurrentSearchOptions.AspectRatio.Add(new RatioViewModel(16, 9)); CurrentSearchOptions.AspectRatio.Add(new RatioViewModel(16, 10)); CurrentSearchOptions.AspectRatio.Add(new RatioViewModel(21, 9)); CurrentSearchOptions.AspectRatio.Add(new RatioViewModel(32, 9)); CurrentSearchOptions.AspectRatio.Add(new RatioViewModel(48, 9)); CurrentSearchOptions.SortType = SortType.Random; CurrentSearchOptions.SortOrder = SortOrder.Descending; } WallpaperDownloader = new Downloader(CurrentSearchOptions.SearchOps) { DeletePrevious = ReplaceImage, FilesToDelete = LastFileDownload, FolderPath = Settings.FolderPath }; WallpaperDownloader.DownloadTriggered += WallpaperDownloader_DownloadTriggered; WallpaperDownloader.DownloadCompleted += WallpaperDownloader_DownloadCompleted; if (DownloadOnStartup) WallpaperDownloader.Init(DateTime.MinValue); else WallpaperDownloader.Init(Settings.LastDownload); CurrentTimer = new TimerViewModel(Settings, WallpaperDownloader); NotifyPropertyChanged("CurrentTimer"); FolderPath = Settings.FolderPath; RunOnStartup = Settings.RunOnStartup; Application.Current.MainWindow.Closing += new CancelEventHandler(MainWindow_Closing); }