Beispiel #1
0
        internal static async Task ShowWallpaper(Wallpaper w, params uint[] screenIndexs)
        {
            await WallpaperManager.Instance.ShowWallpaper(new WallpaperModel()
            {
                Path = w.AbsolutePath
            }, screenIndexs);

            if (AppData.Wallpapers == null)
            {
                AppData.Wallpapers = new List <DisplayWallpaper>();
            }

            foreach (var index in screenIndexs)
            {
                var exist = AppData.Wallpapers.FirstOrDefault(m => m.DisplayIndex == index);
                if (exist == null)
                {
                    exist = new DisplayWallpaper()
                    {
                        DisplayIndex = index, Path = w.AbsolutePath
                    };
                    AppData.Wallpapers.Add(exist);
                }
                exist.Path = w.AbsolutePath;
            }


            await ApplyAppDataAsync();
        }
Beispiel #2
0
        internal static async Task ShowWallpaper(Wallpaper w, int index)
        {
            WallpaperManager.Show(w, index);
            if (AppData.Wallpapers == null)
            {
                AppData.Wallpapers = new List <DisplayWallpaper>();
            }

            var exist = AppData.Wallpapers.FirstOrDefault(m => m.DisplayIndex == index);

            if (exist == null)
            {
                exist = new DisplayWallpaper()
                {
                    DisplayIndex = index, Path = w.AbsolutePath
                };
                AppData.Wallpapers.Add(exist);
            }

            exist.Path = w.AbsolutePath;

            await ApplyAppDataAsync();
        }