private static void OnBalloonTipClicked(object sender, EventArgs e)
 {
     if (AppContext.notifyIcon.BalloonTipTitle == _("Update Available"))
     {
         UwpDesktop.GetHelper().OpenUpdateLink();
     }
 }
Exemple #2
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 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;
        }
        public static void CheckManual()
        {
            string currentVersion = GetCurrentVersion();
            string latestVersion  = GetLatestVersion();

            if (latestVersion == null)
            {
                DarkMessageBox.ShowWarning("WinDynamicDesktop could not connect to the Internet " +
                                           "to check for updates.", "Error");
            }
            else if (IsUpdateAvailable(currentVersion, latestVersion))
            {
                DialogResult result = DarkMessageBox.ShowInformation("There is a newer version " +
                                                                     "of WinDynamicDesktop available. Do you want to download the update now?\n\n" +
                                                                     "Current Version: " + currentVersion + "\nLatest Version: " + latestVersion,
                                                                     "Update Available", DarkDialogButton.YesNo);

                if (result == DialogResult.Yes)
                {
                    UwpDesktop.GetHelper().OpenUpdateLink();
                }
            }
            else
            {
                DarkMessageBox.ShowInformation("You already have the latest version of " +
                                               "WinDynamicDesktop installed.", "Up To Date");
            }
        }
        public static void CheckManual()
        {
            string currentVersion = GetCurrentVersion();
            string latestVersion  = GetLatestVersion();

            if (latestVersion == null)
            {
                MessageDialog.ShowWarning(_("WinDynamicDesktop could not connect to the Internet to check for " +
                                            "updates."), _("Error"));
            }
            else if (IsUpdateAvailable(currentVersion, latestVersion))
            {
                DialogResult result = MessageDialog.ShowQuestion(string.Format(_("There is a newer version of " +
                                                                                 "WinDynamicDesktop available. Do you want to download the update now?\n\nCurrent Version: {0}\n" +
                                                                                 "Latest Version: {1}"), currentVersion, latestVersion), _("Update Available"));

                if (result == DialogResult.Yes)
                {
                    UwpDesktop.GetHelper().OpenUpdateLink();
                }
            }
            else
            {
                MessageDialog.ShowInfo(_("You already have the latest version of WinDynamicDesktop installed."),
                                       _("Up To Date"));
            }
        }
        public static ContextMenu GetMenu()
        {
            List <MenuItem> menuItems = GetMenuItems();

            UwpDesktop.GetHelper().CheckStartOnBoot();

            return(new ContextMenu(menuItems.ToArray()));
        }
        private void SetWallpaper(int imageId)
        {
            string imageFilename = ThemeManager.currentTheme.imageFilename.Replace("*", imageId.ToString());

            UwpDesktop.GetHelper().SetWallpaper(imageFilename);

            lastImageId = imageId;
        }
        static void Main()
        {
            Environment.CurrentDirectory = UwpDesktop.GetHelper().GetCurrentDirectory();
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AppContext());
        }
Exemple #9
0
        public static ContextMenuStrip GetMenu()
        {
            List <ToolStripItem> menuItems = GetMenuItems();

            UwpDesktop.GetHelper().CheckStartOnBoot();

            ContextMenuStrip menuStrip = new ContextMenuStrip();

            menuStrip.Items.AddRange(menuItems.ToArray());

            return(menuStrip);
        }
Exemple #10
0
        public static ContextMenuStrip GetMenu()
        {
            List <ToolStripItem> menuItems = GetMenuItems();

            UwpDesktop.GetHelper().CheckStartOnBoot();

            ContextMenuStrip menuStrip = new ContextMenuStrip();

            menuStrip.Items.AddRange(menuItems.ToArray());
            IntPtr handle = menuStrip.Handle;  // Handle needed for BeginInvoke to work

            return(menuStrip);
        }
Exemple #11
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;
            }

            UwpDesktop.GetHelper().SetWallpaper(imagePath);
            lastImagePath = imagePath;
        }
Exemple #12
0
        static void Main(string[] args)
        {
            string localFolder = UwpDesktop.GetHelper().GetLocalFolder();

            Application.ThreadException += (sender, e) => ErrorHandler.LogError(localFolder, e.Exception);
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
                                                          ErrorHandler.LogError(localFolder, e.ExceptionObject as Exception);

            Directory.SetCurrentDirectory(FindCwd(localFolder));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AppContext(args));
        }
Exemple #13
0
        static void Main(string[] args)
        {
            string localFolder = UwpDesktop.GetHelper().GetLocalFolder();

            Application.ThreadException += (sender, e) => OnThreadException(sender, e, localFolder);
            AppDomain.CurrentDomain.UnhandledException += (sender, e) => OnUnhandledException(sender, e, localFolder);

            string cwd = localFolder;

            if (File.Exists(Path.Combine(localFolder, "WinDynamicDesktop.pth")))
            {
                cwd = File.ReadAllText(Path.Combine(localFolder, "WinDynamicDesktop.pth")).Trim();
            }
            Directory.SetCurrentDirectory(cwd);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AppContext(args));
        }
Exemple #14
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;
            }

            UwpDesktop.GetHelper().SetWallpaper(imageFilename);

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

            lastImagePath = imagePath;
        }
        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
            {
                UwpDesktop.GetHelper().SetWallpaper(windowsWallpaper);
            }

            okButton.Enabled = true;
            this.Close();
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            string themeName = listView1.SelectedItems[0].Text.Replace(' ', '_');

            JsonConfig.UpdateSetting("themeName", themeName, false);
            JsonConfig.UpdateSetting("darkMode", darkModeCheckbox.Checked);

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

            ThemeManager.isReady = true;

            if (LocationManager.isReady)
            {
                this.Hide();

                AppContext.wcsService.HandleNewTheme();

                if (ThemeManager.currentTheme != null)
                {
                    AppContext.wcsService.RunScheduler();
                }
                else
                {
                    UwpDesktop.GetHelper().SetWallpaper(windowsWallpaper);
                }
            }

            this.Close();
        }
 private static void OnStartOnBootClick(object sender, EventArgs e)
 {
     UwpDesktop.GetHelper().ToggleStartOnBoot();
 }