Beispiel #1
0
        public async Task NextDesktopBackground(string path)
        {
            var activeDesktopTheme = GetActiveDesktopTheme();

            if (activeDesktopTheme == null)
            {
                return;
            }

            // Get the Storage File
            StorageTask storageTask = new StorageTask();
            var         file        = await storageTask.GetFileFromPath(new Uri(path));

            Debug.WriteLine($"{nameof(ActiveThemeService)}.{nameof(NextDesktopBackground)} - Converted Path to File: {file.Name}");

            // Set the Wallpaper
            if (await m_wallpaperManager.SetImage(file))
            {
                // Add it to the history if successful
                m_activeDesktopThemeHistorySetting.Add(path);
                m_activeDesktopThemeCurrentWallpaperSetting.Value = path;
                m_activeDesktopThemeNextRunSetting.Value          = DateTime.UtcNow.Add(activeDesktopTheme.WallpaperChangeFrequency);
                Debug.WriteLine($"{nameof(ActiveThemeService)}.{nameof(NextDesktopBackground)} - Successfully Changed Image");
            }
            else
            {
                Debug.WriteLine($"{nameof(ActiveThemeService)}.{nameof(NextDesktopBackground)} - Failed");

                if (DebugTools.DebugMode)
                {
                    m_activeDesktopThemeHistorySetting.Add(path); // REMOVEME: DEBUGGING PURPOSES
                }
            }
        }