private void applyButton_Click(object sender, EventArgs e)
        {
            applyButton.Enabled = false;

            if (selectedIndex > 0)
            {
                ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
            }
            else
            {
                ThemeManager.currentTheme = null;
            }

            JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;
            JsonConfig.settings.darkMode  = darkModeCheckbox.Checked;
            MainMenu.darkModeItem.Checked = JsonConfig.settings.darkMode;

            if (selectedIndex == 0)
            {
                WallpaperApi.SetWallpaper(windowsWallpaper);
            }
            else if (LocationManager.isReady)
            {
                AppContext.wpEngine.RunScheduler();
            }

            applyButton.Enabled = true;
        }
        private void applyButton_Click(object sender, EventArgs e)
        {
            applyButton.Enabled = false;

            if (selectedIndex > 0)
            {
                ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
            }
            else
            {
                ThemeManager.currentTheme = null;
            }

            JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;

            if (selectedIndex == 0)
            {
                WallpaperApi.SetWallpaper(windowsWallpaper);
            }
            else
            {
                AppContext.wpEngine.RunScheduler();
            }

            applyButton.Enabled = true;
        }
Exemple #3
0
        private void ApplySelectedTheme()
        {
            if (selectedIndex > 0)
            {
                ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
            }
            else
            {
                ThemeManager.currentTheme = null;
            }

            JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;

            if (selectedIndex == 0)
            {
                WallpaperApi.SetWallpaper(windowsWallpaper);
            }
            else
            {
                WallpaperShuffler.AddThemeToHistory(ThemeManager.currentTheme.themeId);
                AppContext.wpEngine.RunScheduler();
                AppContext.ShowPopup(string.Format(_("New theme applied: {0}"),
                                                   ThemeManager.GetThemeName(ThemeManager.currentTheme)));
            }
        }
        public override void SetWallpaper(string imageFilename)
        {
            string imagePath = Path.Combine(Directory.GetCurrentDirectory(), "themes",
                                            ThemeManager.currentTheme.themeId, imageFilename);

            WallpaperApi.SetWallpaper(imagePath);
        }
        private void SetWallpaper(int imageId1, int imageId2, double percent)
        {
            string imageFilename1 = ThemeManager.currentTheme.imageFilename.Replace("*", imageId1.ToString());
            string imageFilename2 = ThemeManager.currentTheme.imageFilename.Replace("*", imageId2.ToString());

            string folder     = Path.Combine(Directory.GetCurrentDirectory(), "themes", ThemeManager.currentTheme.themeId);
            string imagePath1 = Path.Combine(folder, imageFilename1);
            string imagePath2 = Path.Combine(folder, imageFilename2);
            string outputPath = Path.Combine(folder, "current.jpg");

            Task.Run(() =>
            {
                var sw = new System.Diagnostics.Stopwatch();

                sw.Restart();
                using (var image1 = new ImageMagick.MagickImage(imagePath1))
                    using (var image2 = new ImageMagick.MagickImage(imagePath2))
                    {
                        image1.Quality = 98;
                        image1.Composite(image2, ImageMagick.CompositeOperator.Blend, Math.Round(percent * 100).ToString());
                        image1.Write(outputPath);
                    }
                sw.Stop();
                Console.WriteLine($"NEW: {sw.ElapsedMilliseconds}");

                GC.Collect();

                WallpaperApi.EnableTransitions();
                UwpDesktop.GetHelper().SetWallpaper("current.jpg");
            });

            lastImagePath = outputPath;
        }
Exemple #6
0
        private void SetWallpaper(int imageId)
        {
            string imageFilename = ThemeManager.currentTheme.imageFilename.Replace("*", imageId.ToString());
            string imagePath     = Path.Combine(Directory.GetCurrentDirectory(), "themes",
                                                ThemeManager.currentTheme.themeId, imageFilename);

            if (imagePath == lastImagePath)
            {
                return;
            }

            WallpaperApi.EnableTransitions();
            UwpDesktop.GetHelper().SetWallpaper(imageFilename);

            if (Environment.OSVersion.Version.Build >= 21337)
            {
                if (!virtualDesktopInit.IsCompleted)
                {
                    virtualDesktopInit.Wait();
                }

                foreach (VirtualDesktop desktop in VirtualDesktop.GetDesktops())
                {
                    if (desktop.Id != VirtualDesktop.Current.Id)
                    {
                        desktop.WallpaperPath = imagePath;
                    }
                }
            }

            lastImagePath = imagePath;
        }
        private void SetWallpaper(int imageId)
        {
            string imageFilename = ThemeManager.currentTheme.imageFilename.Replace("*",
                                                                                   imageId.ToString());
            string imagePath = Path.Combine(Directory.GetCurrentDirectory(), "images",
                                            imageFilename);

            WallpaperApi.SetWallpaper(imagePath);
            lastImageId = imageId;
        }
        public override async void SetWallpaper(string imagePath)
        {
            WallpaperApi.EnableTransitions();

            var uri = new Uri("ms-appdata:///local/themes/" + ThemeManager.currentTheme.themeId + "/" +
                              Path.GetFileName(imagePath));
            var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);

            var profileSettings = Windows.System.UserProfile.UserProfilePersonalizationSettings.Current;
            await profileSettings.TrySetWallpaperImageAsync(file);

            WallpaperApi.SyncVirtualDesktops(imagePath);
        }
Exemple #9
0
        private void SetWallpaper(int imageId)
        {
            string imageFilename = ThemeManager.currentTheme.imageFilename.Replace("*", imageId.ToString());
            string imagePath     = Path.Combine(Directory.GetCurrentDirectory(), "themes",
                                                ThemeManager.currentTheme.themeId, imageFilename);

            if (imagePath == lastImagePath)
            {
                return;
            }

            WallpaperApi.EnableTransitions();
            UwpDesktop.GetHelper().SetWallpaper(imageFilename);

            lastImagePath = imagePath;
        }
Exemple #10
0
        private void SetWallpaper(int imageId)
        {
            string imageFilename = ThemeManager.currentTheme.imageFilename.Replace("*",
                                                                                   imageId.ToString());
            string imagePath = Path.Combine(Directory.GetCurrentDirectory(), "themes",
                                            ThemeManager.currentTheme.themeName, imageFilename);

            WallpaperApi.SetWallpaper(imagePath);

            if (UwpDesktop.IsRunningAsUwp() && JsonConfig.settings.changeLockScreen)
            {
                UwpHelper.SetLockScreenImage(imagePath);
            }

            lastImageId = imageId;
        }
Exemple #11
0
        private void ApplySelectedTheme()
        {
            if (selectedIndex > 0)
            {
                ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
            }
            else
            {
                ThemeManager.currentTheme = null;
            }

            JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;

            if (selectedIndex == 0)
            {
                WallpaperApi.SetWallpaper(windowsWallpaper);
            }
            else
            {
                AppContext.wpEngine.RunScheduler();
            }
        }
Exemple #12
0
        private void okButton_Click(object sender, EventArgs e)
        {
            okButton.Enabled = false;

            string themeName = listView1.SelectedItems[0].Text.Replace(' ', '_');

            JsonConfig.settings.themeName = themeName;
            JsonConfig.settings.darkMode  = darkModeCheckbox.Checked;

            if (selectedIndex > 0)
            {
                ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
            }
            else
            {
                ThemeManager.currentTheme = null;
            }

            MainMenu.darkModeItem.Checked = JsonConfig.settings.darkMode;
            this.Hide();

            if (selectedIndex > 0)
            {
                AppContext.wcsService.LoadImageLists();

                if (LocationManager.isReady)
                {
                    AppContext.wcsService.RunScheduler();
                }
            }
            else
            {
                WallpaperApi.SetWallpaper(windowsWallpaper);
            }

            okButton.Enabled = true;
            this.Close();
        }
 public override void SetWallpaper(string imagePath)
 {
     WallpaperApi.SetWallpaper(imagePath);
 }