public static async Task SetWallpaperAsync(string wallpaperFile) { if (Settings.Default.wallpaperFade) { Logger.Instance.LogMessageToFile("Applying wallpaper using Active Desktop.", LogLevel.Information); await HelperMethods.StartSTATask(() => { using (var activeDesktop = new ActiveDesktop()) { activeDesktop.SetWallpaperWithFade(wallpaperFile); } }) .ConfigureAwait(false); } else { Logger.Instance.LogMessageToFile("Applying wallpaper using standard process.", LogLevel.Information); SetWallpaper(wallpaperFile); } }
private async Task <bool> SetWallpaperAsync(RedditLink redditLink, string wallpaperFile) { if (!WallpaperSizeValid(wallpaperFile)) { return(false); } await ActiveDesktop.SetWallpaperAsync(wallpaperFile).ConfigureAwait(false); _noResultCount = 0; _uiMarshaller.UpdateStatus("Wallpaper Changed!"); Logger.Instance.LogMessageToFile("Wallpaper changed!", LogLevel.Information); _currentSessionHistory.Add(redditLink.ThreadId); var redditImage = await _database.AddWallpaperToHistoryAsync(redditLink) .ConfigureAwait(false); await _database.BuildThumbnailCacheAsync().ConfigureAwait(false); _uiMarshaller.AddImageToHistory(redditImage); if (!Settings.Default.disableNotifications && Settings.Default.wallpaperInfoPopup) { _uiMarshaller.OpenPopupInfoWindow(redditLink); } if (Settings.Default.autoSave) { HelperMethods.SaveCurrentWallpaper(Settings.Default.currentWallpaperName); } _uiMarshaller.UpdateStatus(""); return(true); }